In Sharepoint, there is a special list ‘User Information List’ for user’s profile information storage. This list is quite handly to play around with user profile data. When a user is added to the Sharepoint site, a list item is automatically created in this list. To update the user’s information in ‘User Information List’, for instance, to update the user’s photo, I am using following code and it works fine:
SPSite siteCollection = null;
SPWeb web = null;siteCollection =
SPContext.Current.Site;
web = siteCollection.RootWeb;
web.AllowUnsafeUpdates = true;
Microsoft.SharePoint.SPList list = web.Lists["User Information List"];Microsoft.SharePoint.
SPUser u = web.SiteUsers[@"sharepoint\waqas"];
Microsoft.SharePoint.SPListItem it = list.Items.GetItemById(u.ID);it[
"Picture"] = "http://www.beyondweblogs.com/personal/trothman/Shared%20Pictures/Profile%20Pictures/waqas.jpg";
it.Update();
Tags: