using (SPSite mySiteCollection = new SPSite("http://myserver/myspsite"))
{
using (SPWeb mySite = mySiteCollection.OpenWeb(mySiteCollection.RootWeb.ID))
{
SPList usersList = mySite.SiteUserInfoList;
}
}
Note that there is another way to acces this list but I don't recommend it because it can throw an exception in a couple of situations:
using (SPSite mySiteCollection = new SPSite("http://myserver/myspsite"))
{
using (SPWeb mySite = mySiteCollection.OpenWeb(mySiteCollection.RootWeb.ID))
{
SPList usersList = mySite.Lists["User Information List"];
}
}
No comments:
Post a Comment