SharePoint's hidden user-list - User Information List
SharePoint's hidden User Information List has been around for a long time. Already in SharePoint 2007, and all the way around to SharePoint 2019 that is currently rolled out. Learn more about it here.
Table of Contents
Update 2019: This post is updated with screenshots based on SharePoint 2019.
Update 2016: This post was initially written in June 2008. The User Information List still exists in SharePoint 2016 and onward.
Note: This list is only visible to and accessible by administrators.
Updated quick links for common troubleshooting:
- How to remove deleted users from SharePoint (Someone is deleted from Microsoft 365 Admin center, but still appears in SharePoint).
User Information List – Background
In SharePoint, we have the User Information List in SharePoint, which stores information about users. Some examples are Picture, Email, DisplayName, LoginName, and more.
For a complete list of fields, see further down this blog post under "User Information List Fields".
Something to note is that when a user gets access to a site, a new item will be created in the User Information List, storing some information about the user.
When a user adds/create or edit an item, SharePoint will display something like Last modified at 1/1/2008 by Tobias Zimmergren
like the following pic:
In this example the DisplayName (used to display System Account) is gathered from the User Information List.
Browsing the User Information List
The User Information List can be accessed, if you're an admin, via the browser by navigating to /_catalogs/users/simple.aspx
from your site. For example, like this: https://intra.zimmergren.net/_catalogs/users/simple.aspx
.
Updated 2019: This works on SharePoint 2007, SharePoint 2010, SharePoint 2013, SharePoint 2016, and SharePoint 2019.
In SharePoint 2019, the User Information List looks like this:
In SharePoint 2007, the User Information list looks like this:
Oh, the memories of WSS 3.0 and MOSS 2007. Good times 🚀
Write code to interact with the User Information List.
If you want to interact with this list to set properties on a user (In my case, I'm doing this, and I'm using WSS 3.0 at the writing of this post) you could do it like this:
// Instantiates the User Information List
SPList userInformationList = SPContext.Current.Web.SiteUserInfoList;
// Get the current user
SPUser user = SPContext.Current.Web.EnsureUser(@"ZIMMERGREN\TobiasZimmergren");
// The actual User Information is within this ListItem
SPListItem userItem = userInformationList.Items.GetItemById(user.ID);
The above code will give you the SPListItem
object, which links to the currently logged in user (the one executing the request).
You can then work with the SPListItem
object like usual to get or set the properties like this:
string pictureURL = userItem["Picture"].ToString();
User Information List Fields
Instead of writing out all the fields/columns available, you can create a new Console Application and insert the following code to output all the fields names and internal names:
SPWeb web = new SPSite("https://intra.zimmergren.net").OpenWeb();
SPUser user = web.EnsureUser(@"ZIMMER\tozi");
SPListItem item = web.SiteUserInfoList.Items.GetItemsById(user.ID);
foreach (SPField f in item.Fields)
{
// Output on all the existing fields
// and gets their InternalName as well
System.Console.WriteLine("Title: {0} -- {}",
f.Title,
f.InternalName);
}
Thank you for reading
While this post was originally authored in 2008, the User Information List is still there, and still having its purpose. Things have changed, and there are other ways to interact with the list today (2022 and onwards).
Enjoy.
Recent comments