Header

Monday, 24 October 2011

How to get User Details in sharepoint.

////////////////////////////////////////////////////////

  1. Dim user As SPUser = SPContext.Current.Web.CurrentUser

  2. Checking is current login is admin or not?

    SPContext.Current.Web.CurrentUser.IsSiteAdmin

  3. This will give, all group, which are present in current site

    SPContext.Current.Web.Groups

    This will give the group name of current user

    SPContext.Current.Web.CurrentUser.Groups

  4. Here i m getting all user and add in one DropDownList

    Dim websp As SPWeb = SPContext.Current.Site.RootWeb
    Dim users As SPUserCollection = websp.AllUsers
    For Each i As SPUser In users
    dropdownlist1.Items.Add(CStr(i.Name))




No comments:

Post a Comment