SharePoint’s hidden user-list – User Information List

Okay, this might not come as news to most SharePoint developers who’ve been around a while, but lately I’ve been messing with the User Information List in SharePoint and it doesn’t seem that many people know that it exists.

Note: This list is only visible to and accessible by administrators.

User Information List – Background

The User Information List stores information about a user by having some metadata set up for the user. Some examples are Picture, Email, DisplayName, LoginName etc. ) For a complete list of fields, see further down this blogpost under "User Information List Fields".

Something to note is that when a user is granted access to a site, a new item will be created in the User Information List storing some information about the user.

When a user add/create or edit an item, SharePoint will display something like "Last modified at 1/1/2008 by Tobias Zimmergren" like the following pic:

image

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 (Only if you’re admin) via the browser by navigating to /_catalogs/users/simple.aspx from your site. (Ex: http://zimmergren/_catalogs/users/simple.aspx)

This works for both Windows SharePoint Services 3.0 (WSS 3.0) and Microsoft Office SharePoint Server 2007 (MOSS 2007) and looks like this when you access it through the browser:

image

Write code to interact with the User Information List

If you want to interact with this list to set properties on a user (Probably only want to do this if you’re running WSS) 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(@"ZIMMERTobiasZimmergren");

// The actual User Information is within this SPListItem
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 normal 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 availible, you can simply create a new Console Application and insert the following code in order to output all the fields names and internalnames:

image
Note: You will ofcourse have to change the URL and User LoginName
Note2: No comments needed about not disposing the objects as this was merely a sample, eh? ;)

You’re welcome

Hope this will enlighten some of you people in your quest for the holy grail (SharePoint All-Mighty Knowledge?)

Work is calling me, so I’ll have to end this small post right here and right now, catch you soon again.

Follow me

Tobias Zimmergren

Founder / Consultant / Advisor at TOZIT AB
Tobias Zimmergren delivers high-quality articles about business and technology around the Microsoft scene.

Tobias focuses on advisory and consultancy for the Office 365 and SharePoint offerings from Microsoft.
Follow me
  • Barış Engez

    wow that was really helpful, thanks

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Barış Engez,

      You’re most welcome.

      Cheers,
      Tobias.

  • Testuser

    it seems that not all items are available through this method… Picture, Title, etc. are ok, but eg. Fax or other custom fields won’t show up. is there a possible solution, or even a info which fields are available to query using this method.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi,

      Then you need to use the User Profile API’s, not the User List. To fetch mapped properties and imported properties from the AD I’d recommend using the User Profile classes instead. That is for SharePoint Server, not Foundation/WSS though.

      Cheers,
      Tobias.

  • Surya S Mishra

    Hi. Useful post. Have a question though. If it’s a list like others on the site, will custom event handlers work? For example if i want to handle the event when a user is added to a particular group or deleted from one? Did you ever get a chance to try that?

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Surya S Mishra,

      As for events on the User Information List, please refer to this article: http://msdn.microsoft.com/en-us/library/aa979520.aspx

      You can see a section telling you this:
      “List events are not raised on the UserInformation list type. Resolution: None.”

      I’m not sure if this has been taken care of and if there’s way to handle it today – however you could also try parsing the audit logs (first turn on auditing) and then query the audit logs for changes in the groups. That would mean some delays between the group being changed and the event being fired though..

      Regards,
      Tobias.

  • Kate

    tack Tobias!
    Sharepoint was driving me nuts as a newbie…. this has helped.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Inga problem, Kate!
      You’re most welcome – I’m glad I could help :-)

  • Arsalan Adam Khatri

    A quick question, I am having an issue when accessing SPContext.Current.Web.SiteUserInfoList in Anonymous access mode… Is there a method to access this List in Anonymous mode.. My site will be Public Facing and I need users info :(
    Please help!
    Arsalan Adam Khatri

    • http://www.zimmergren.net/ Tobias Zimmergren

      Arsalan Adam KhatriCollapse,

      You could try Impersonation in various ways to access the various restricted parts of the API. One example to start with is to wrap your code in a SPSecurity.RunWithElevatedPrivileges method.

      Of course there’s a reason for why some things are not available in anonymous mode – so be sure to design it in a way that doesn’t compromise your system.

      Regards,
      Tobias.

  • Sankarlal87

    Hi Tobias,

    This is a good info Thanks.

    I have an issue in WSS 3.0 that when i add a user called “user1″ it picks the login name correctly but in the “display name” and “Email id” field it shows others ( user2’s) display name and email id.
    This happends for only one user all others are fine.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Sankarlal87,

      I haven’t seen this behavior before. Would you mind verify that you get the same behavior on other site collections or web applications as well?

      Regards,
      Tobias.

  • Sun

    Hi! This is an AWESOME discovery. I’m having a problem applying it because I don’t know where I got o copy and paste this information. I have full access to my organizations SP site. I work with a vendor who is accountable for the customizations to our site. However, due to our financial situation, our contract is on hold. while waiting, I’d like to be proactive and apply what I need to. could you provide me a step by step description/guide/explanation on how I can do this?

    I went to sharepoint designer and posted this information into the code view and I just got the code. I went into a page and inserted a content editor web part and the same happened. Where do I have to go? I mean literally after you log into the SP site.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Sun,

      I’m glad you liked it. I am however not sure about what you want to achieve. What would you like to customize or what would you want to do with your SharePoint site?

      Let me know some more details and I’ll see if I can help you out.

      Cheers,
      Tobias.

      • Sun

        Hi Tobias,

        I just would like to create an active users web part in an external facing website that I am building in SharePoint. I’d like the user part to show a picture of no more than 5 of our active users in our site. Next to their image would be 1 column with 3 rows of information: Name;Company;City,ST.

        Active would be anyone who has logged into our site more than 10 times, or has certain points, or some way for me to track and assign a metric to their activity in the site. If you have something for that, I’d like to know about this too. Please.

        • http://www.zimmergren.net/ Tobias Zimmergren

          Hi Sun,

          There’s multiple ways of achieving that. The first thing you’ll need to consider is where to store the information about user visits. For example; every time a user visits your site and they are logged in, you’ll need to log that visit somewhere so you can query the information and list in your “Top 5″ list of active users.

          Then you create a custom Web Part that will query your custom list with information and render the top 5 users in whatever way you want to render it.

          All in all, it would be pretty easy to imlement but I don’t have any code ready for you t just copy/paste unfortunately.

          Regards,
          Tobias.

          • Sunshine_flowerss

            Thanks Tobias. I’m fairly new to SharePoint so I’m not sure how to do what you mentioned above. I will however, use your information and find a way. Too bad you don’t have any code available, that would help me out greatly. If I get something together, I will share it with you just so that you can have it on file for someone else. thanks again.

            Sun~

  • Anupama K13

    Thanks for the explanation. I would like to know, how much time does the user Information list would take to create an item when a user has first logged in.

    Awaiting your reply….! please help…

  • metpa

    Hi, i had a question with sharepoint. We have a sharepoint foundation and i was trying to create an intranet in/out board ( a custom list). How do i pull the user information for a look up column on my list? I go to the drop down “get information from” and i dont see the user information on it. Please help me..
    Thank you so much

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi metpa,

      I realize this is probably a late reply, but better late than never.

      The reason why you can’t see it in the drop down there is because it’s a hidden list. It isn’t meant to be used in a lookup columns. However you can access it programmatically or using PowerShell.

      Of course you could most likely “unhide” the list (theList.Hidden = false;) but I would strongly advice against it!

      Cheers,
      Tobias.

  • Tim

    Thanks, this was great help. We had a user that had a picture on a specific subsite and I was trying to access this list in order to remove it. It was not grabbing from MySites as it was for other users. I am not sure how he even managed to accomplish this feat but I was able to nullify his image to an external link.

  • Jay Paterson

    I’ve created a console app to get the user fields as shown above…. I’m using SP 2010 server.

    When I try to run it in VS2012 or as a compiled exe I keep getting a web application not found error and I’m not sure why.
    I have it exactly as
    SPWeb web = new SPSite(“http://xxx-xxxx/”).OpenWeb();
    I even went as far as pasting the very simple url from the browser to my code to be sure.
    In both cases I am right clicking and choosing run as admin.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Jay,

      You need to specify more about your error message in order for me (or someone else reading) to be able to help out :-)

      / Tob.

    • Joakim

      Late reply, but for those who google this:
      You need to compile the console application as 64-bit when using it with SP 2010, otherwise you’ll get exacly that puzzling error – the site cannot be found.

  • http://www.facebook.com/dan.wakefield.3158 Dan Wakefield

    Just what I was looking for – Many thanks :)

    • http://www.zimmergren.net/ Tobias Zimmergren

      Cheers Dan.

  • Larry Virden

    Good afternoon. This is a useful introduction to a topic of interest. I find myself with a puzzle that should be able to be solved using PowerShell. I am just learning the language and your article gives me a few pieces. I am hoping that the things I want to do are also possible.
    We have a small SP 2007 farm. We are finding that while some of the userinfo list is up to date, there are some cases which cause us problems. I would like to write a script that takes a site collection’s userlist, compares the user’s account name and their user name (aka login name), and tell me when these two items differ. In theory, they should not differ. In reality, in our environment, when a user’s name changes, their login changes. That change is synched for the user name profile value, but the account field is not changing.

  • Pingback: Filter Disabled AD Accounts in People Picker using stsadm for SharePoint 2013 | Shane Wang()

  • Pingback: Filter Disabled AD Accounts in People Picker using stsadm for SharePoint 2013 | My Website()

  • Pingback: Filter Disabled AD Accounts in People Picker using stsadm for SharePoint 2013 | SPS – SharePoint Shane()

  • Pingback: Foundation User Profile Service 2010 or FUPS 2010 | B.J. Fentress()

  • Fred Allen

    That was extremely helpful. I was going crazy trying to find this list to change a typo in an email address.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Fred,

      Thank you for your comment, I appreciate it.

      Tob.

  • Pingback: Importing SharePoint user profile properties using BCS .NET Connectivity Assembly | Second Life of a Hungarian SharePoint Geek()

  • Sudeer

    Hi Tobias,
    I have one request. Could you please help me to pull manager column from UserInformation list which is currently not availbale in this list.

    I have a requirement that if Manager opens the InfoPath form the drop down should pull all user’s name who comes under him. Dropdown should populate users who has common manager.

    Thanks and Regards,
    Sudeer

  • Pingback: Recurring authentication prompt when editing task list in datasheet view | Second Life of a Hungarian SharePoint Geek()

  • Guruprasad Marathe

    Hi Tobias,
    http:///_catalogs/users/simple.aspx
    http:///_catalogs/users/detail.aspx

    i want to update this views with new columns lets say Department and BU, i can do it manually but i have 400 site collections. i want to automate this process powershell,
    any help ?

  • Larry Tenison

    This is very helpful, thanks for posting. I have a slightly different issue. I added a new SP 2010 User Profile property called Org, mapped to an AD attribute. Ran a full synch and the new property shows up when I view a random user’s User Profile settings. However, I went to add the new column to the default user List View and it is NOT available in the choice of user property columns. I’ve tried just about everything I can think of, still cannot get that column to show up in the property columns. I did this process on the Test system and had no issues. Does anyone have any idea why this column is not showing up?

  • Patrizio

    Hi Tobias. your post is very helpful, but i need an other information…I need to put inside this list a custom column “birthday” but i don’t know how to do…you can help me?
    thanks in advance…

  • raja

    Hi,
    in our organisation out team creatd a sharepoint site for internal use, now we want to know the visitor details who visited out site. is it possible to implement?

  • Pingback: SharePoint – Alerts not working | techblog()

  • Whirlaway4ever

    What would cause machine names to appear in the User Information List? We currently see users AND some computers listed.

  • Julie

    Hi Tobias,
    We are working on sharepoint 2013. How can we access the user information as a list ?