From the outside in

The blog of Iain Angus

Accessing User Profile Information in WSS 3.0

MOSS and WSS 3.0 handle user profiles differently. In MOSS, user profile information is stored centrally and can be shared across site collections. Profiles can be manipulated using the UserProfileManager class found in Microsoft.Office.Server.dll.

Life just isn't the same when working with WSS 3.0. When developing a workflow, for example, it may be useful to access a property of the user profile. You can't use UserProfileManager as it doesn't exist and SPUser doesn't expose most of the profile information. In WSS 3.0 the user profile information is stored in a hidden list specific to an individual site collection. If you have multiple site collections, a different hidden list is used for each site collection. The User Profile Information is just another list and can be treated as such -

SPList userProfileList = web.Lists["User Information List"];

foreach (SPListItem user in userProfileList.Items)
    Console.WriteLine(user["Name"] + " " + user["Department"];

The cut down C# above lists all the user names and departments.

Accessing the user profile information in WSS 3.0 is straightforward, once you know how ;-)

Comments (6) -

  • Iain

    7/16/2008 9:50:06 AM |

    There is a problem here , only administrators can view this list programmatically and how to view it if the looged user is not administrator ?????

    please replay here and on my mail


  • Iain

    11/24/2008 6:07:17 PM |

    Found this post you made just recently. It was helpful in at least getting me in the right ball park but the items returned above still seem to be limited. I can not find the Business phone number of a profile for the life of me. Any suggestions?

  • Iain

    12/6/2008 3:20:41 PM |

    Thanks for the comment John. I assume you have added Business Phone to the user profile list from the existing site columns? If so getting the business phone is straightforward. In the above example, simply use user["Business Phone"].

    Let me know if this is what you were asking?

  • Iain

    12/29/2008 10:32:11 PM |

    Is there any difference between the "User Information List" and the "UserInfo" list?   It appears that the SPUserCollection at SPContext.Current.Web.Users appears to point to "UserInfo" which has a different GUID.  Is this just a subset of data, ie the "Person" ContentType of the "User Information List", and if so can you access custom fields or the row/item data from this object?

    I'm trying to create a MembershipContentType that I can add to the "User Information List" along with a SharePointListMembershipProvider and was wondering the easiest way to obtain the requested user, either as a SPUser or a List Item.

  • Maya

    5/5/2009 2:02:20 PM |

    Hello Lain,
    My question is same as Wael , I din't have access to userdisp.aspx programatically

    and I followed  your given solution but still it doesn't work when I log in as different user than Admin, what should I do! any idea??

    Please reply me back to my email or hear.

    Thanks alot and have a good day

  • Iain

    7/7/2009 7:57:43 PM |


    I've been trying to create a SPSite object but I keep getting the error message "The web application at the could not be found." Even when I'm running the shell locally on the sharepoint server. Any ideas ?

  • Iain

    10/6/2009 3:03:13 PM |

    Thanks a lot!!! This post was a great help to me as I was wondering how to access user profile in WSS.

  • Iain

    11/29/2010 3:28:43 PM |

    But before you look up the properties in a profile, you need to know what the properties are, right?  I have been trying to find out how a user's email address is identified in the profile but have had no luck.  I have tried e-mail, mail, email, work e-mail, worke-mail, workemail, but none of these work.  So how can I find out the property titles in WSS (no MOSS)?

Comments are closed