This is another task that seemed to escape me for the longest time. We have a list of Users (SPContext.Current.Web.Users) that we can access and look through but why aren’t their photos defined in this list?
Well it turns out there is another hidden list that maintains this info called SPContext.Current.Web.SiteUserInfoList. The trick to getting a users photo is quite simple, you just have to know to look for an attribute called “Picture”.
//Get the User Info List
SPList userInfoList = SPContext.Current.Web.SiteUserInfoList;
//Select a specific user
SPListItem userInfoListItem = userInfoList.GetItemById(userInfoId); //or other method
string imageUrl;
if (userInfoListItem["Picture"] != null)
{
imageUrl = userInfoListItem["Picture"].ToString().TrimEnd(' ').TrimEnd(',');
}
Simple!
Related posts:
- Sharepoint Web Part Grouping
- Windows SharePoint Services Help Search – SPSearch Starting Error
- Developing faster web forms in .NET
- “Capitalise” jquery extension
- Crystal Report Challenges
Tags: sharepoint, users, wss




