Friday 13 April 2012

User Id from User Information List (Hidden Web Site List in SharPoint)

This list can be accessed by the link " /_catalogs/users/simple.aspx" from the every SharePoint web site.

To get the data from this list use the following code :
SPList spList = SPContext.Current.Web.SiteUserInfoList;

Using this the basic information about the user can be accessed.
SPSite spsite = new SPSite("http://MyWebApplication");

SPWeb spweb = spsite.OpenWeb();

SPList splist=spweb.SiteUserInfoList;

SPListItem userInfo = splist.Items.GetItemById(SPContext.Current.Web.CurrentUser.ID);

string pictureURL = Convert.ToString(userItem["Picture"]);

No comments:

Post a Comment