SharePoint User Information List Extensions

I’m currently writing on issue 6 of USP Journal, which will revolve around two solutions I’m putting up on CodePlex next week (that would be the week beginning August 17 2009, if you are not reading this right after I publish this, which is a nice segue to reminding you that you can subscribe to updates from my blog using RSS).

Anyway, one thing that I’m using is extending the user information list to store additional user data. I wrote about manipulating the SharePoint user information list in issue 1 as well, and I think the user information list is a great way of storing information to personalize a SharePoint solution.

In any case, to work with the extended properties, you cannot address the SPUser object directly, as this object only contains pre-defined properties. As such, you need to convert the current user object into a regular SPListItem item, and then access the properties of that SPListItem.

The following code does the trick:

// Find current user from SPWeb web…
SPUser spUser = web.CurrentUser;
// …and the site’s user information list
SPList userList = web.SiteUserInfoList;
// …and again the user
SPListItem user = userList.Items.GetItemById(spUser.ID);

You can then access your extended properties as such:

string themeUrl = user["Style"].ToString();

Of course, the column Style must be present in the user information list, but you can simply add that column, either manually through the list settings or through code, as I’ll show you in issue 6.

By the way, USPJ issue 6 will be on two solutions, one for a solution to supportable custom SharePoint themes and the other for a sample data extractor, based on the technique I showed in one of the YouTube bonus videos from issue 5.


Found this article valuable? Want to show your appreciation? Here are some options:

a) Click on the banners anywhere on the site to visit my blog's sponsors. They are all hand-picked and are selected based on providing great products and services to the SharePoint community.

b) Donate Bitcoins! I love Bitcoins, and you can donate if you'd like by clicking the button below.

c) Spread the word! Below, you should find links to sharing this article on your favorite social media sites. I'm an attention junkie, so sharing is caring in my book!

Pin It

Published by

Bjørn Furuknap

I previously did SharePoint. These days, I try new things to see where I can find the passion. If you have great ideas, cool projects, or is in general an awesome person, get in touch and we might find out together.

One thought on “SharePoint User Information List Extensions”

Leave a Reply

Your email address will not be published.