User Information List in SharePoint 2016 or SharePoint 2013

Most of us know that SharePoint has many hidden lists to perform various tasks. Now we are doing deep dive on “users” list. This list is one of the important list exists at site collection level. The hidden Users list was there from MOSS onwards and you can see this list even in SharePoint 2016 also. Here we will discuss about what is an user information list?  How we can retrieve the user information list from the broswer? How we can get user information list by using server object model url? How we can retrieve user information fields using server object model?

Note: This list can be accessible by only Site Collection administrators and FARM administrators.

What is User Information List in SharePoint 2013?

The “User Information List” in SharePoint stores the information about a user with some metadata configured / added to user as part of Active Directory (AD) like user Picture, DisplayName and Login Name (domain\user-id) e.t.c.

Read SharePoint 2013 tutorials

How User Information List gets data?

As soon as you add / grant access to user at sub site/ Site Collection level SharePoint added a new entry in this list with the latest information of that user from AD. In precise if there is any change in user details especially in user-email (or) user role SharePoint add one more new entry in this list as there is change in user’s metadata. So, some time we end up finding more than one entry for one user.

How to access User Information List in UI?

The User Information List can be accessed via the browser by navigating to “/_catalogs/users/simple.aspx” from your site.
Ex:
http://contoso.com/_catalogs/users/simple.aspx
****************************** Add a Screenshot **********************

Connect with Server side Object Model:

We can connect to this hidden list to get the user information for the required user. Please find the below code snippet for the same.
// Instantiates the User Information List
SPList userInformationList = SPContext.Current.Web.SiteUserInfoList;
// Get the current user
SPUser user = SPContext.Current.Web.EnsureUser(@”CONTOSO\krishna”);
// The actual User Information is within this ListItem SPListItem userItem = userInformationList.Items.GetItemById(user.ID);
string pictureURL = userItem[“Picture”].ToString();

With the above code snippet you can get the picture URL of the user. Which clearly shows that reading information from this list is as same as any other list in SharePoint.

User Information List Fields:

I would like to make our life easy, below is the code snippet for to get all the fields and their internal names.
You can copy this code in a Console application to see the reults.

SPWeb spWeb = new SPSite(http://contoso.com/).OpenWeb();
SPUser user = spWeb.ensureUser(@“CONTOSO\krishna”);
SPListItem item = spWeb.SiteUserInfoList.Items.GetItemById(user.ID);


Foreach(SPField objfld in item.Fields)
{
Console.WriteLine(“Field Name:: {0}, Field Internal Name :: {1}”,objfld.title,objfld.InternalName);
}

Hope this helps. Enjoy the beauty of SharePoint !!!!!


You May Also like the Following SharePoint Online Tutorials:

About Krishna Vandanapu

I am Krishna.Vandanapu a SharePoint architect working in IT from last 12 years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019

View all posts by Krishna Vandanapu →