In this post, we will discuss how we can get profile picture url from User Information List using SharePoint 2013 server object model. User Information List is a hidden list maintains by SharePoint which contains one entry for every user who accessed the site collection or explicit access has been given to any particular user. This list contains basic information like About me, Picture url, Name, Title, Department etc.
If SharePoint farm is using User Profile Application, then these User Information List fields will not be editable rather it will redirect to My Site Host. If your SharePoint farm is not using User Profile Application, the user can be able to edit the User Information List fields.
Also, you may need to check:
– SharePoint 2013 SPListItem method Update SystemUpdate and UpdateOverwriteVersion
Here in this example, we will try to retrieve the user profile picture url from User Information List using the Server object model.
Below is the full code.
string LoginName = string.Empty;
string SiteUrl = SPContext.Current.Site.Url;
string Username = SPContext.Current.Web.CurrentUser.LoginName;
SPSite Site = new SPSite(SiteUrl);
string pictureUrl = string.Empty;
using (SPWeb Web = Site.OpenWeb())
SPList List = Web.Lists[“User Information List”];
SPQuery Query = new SPQuery();
Query.Query = “<Where><Eq><FieldRef Name = ‘ID’/><Value Type=’Text’>”+Username+”</Value></Eq></Where>”;
ItemCollection = List.GetItems(Query);
if (ItemCollection.Count > 0)
foreach(SPListItem ListItem in ItemCollection)
if(ListItem[“Picture”] != null)
pictureUrl = ListItem[“Picture”].ToString();
Hope this will be helpful.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: