User Information in SharePoint Foundation 2

Mike BerrymanSharePoint Foundation does not have a User Profile Service, so how are users managed?

It turns out that there is a hidden system list on SharePoint Foundation (actually all versions of SharePoint, but much more useful in SharePoint Foundation).  To view this list, you simply visit http://<YourSharePointSite>/_catalogs/users/simple.aspx or details.aspx.

This isn’t anything new to anyone who’s managed users in SharePoint, but as I discovered it’s pretty difficult to actually do much from an administrative perspective with the list.

I had a situation where I needed to create a sort of User Directory for the end user to view all users in the SharePoint site.  Being on Foundation, they did not have access to the User Profile Service and consequently, people search results.  They wanted the ability to search for a user and display information about the user – nothing too difficult, and easy as pie if you had access to the people search results.  Since I didn’t, I opted to go with a solution where I’d list all the users in a true Company Directory type fashion and give the user search capabilities on that listing.

The first part of this solution was just getting some way to output all the users onto a page.  A Data Form Web Part allows for high amounts of customization, but the snag is that you can’t select the User Information List when you’re creating a new Data Form Web Part.  What’s a guy to do?  Well, I figured that if I could get the list ID of the User Information List, then I could just create a Data Form Web Part using any other list and then just replace the List IDs with the ID of the User Information List.  So…how do you get the User Information List’s ID?

I could not find any way to get the ID from the UI, so I fell back to creating a quick console application that would fetch the ID programatically.  Here’s the snippet of code to do just that:

static void Main(string[] args)
{
    using (SPSite site = new SPSite("<SharePoint Site>"))
    {
        using (SPWeb web = site.OpenWeb())
        {
            SPList userInfoList = web.SiteUserInfoList;
            Console.WriteLine("User Information List ID: {0}", userInfoList.ID);
        }
    }
}

Using the ID, I could replace all the IDs in the Data Form Web Part with the User Information List ID, and really that was that.  At that point it behaves just like any other list, and managing the output to behave like a directory was a simple matter.

2 comments

  1. We also are on 2010 Foundation and I’ve been trying to figure a way to copy items from the User Information lists to a custom sharepoint list. Basically I want a custom sharepoint list with all users that have access to the site so i can apply workflows to this new list. Only way i could think of was trying to pull users from the user information list so when that gets updated my custom list will also have the new users. Workflow doesn’t appear to work with the User Information List. Any ideas would be much appreciated

    Like

  2. I am having the same trouble. I want to copy the UserInfo table into an Access database; however, I need the ListID for the UserInfo table. I can’t seem to get to it. Where exactly do I put your sample code to obtain this ListID?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s