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 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 fileds will be not be editable rather it will redirect to My Site Host. If your SharePoint farm is not using User Profile Application, then user can be able to edit the User Information List fileds.
Also you may need to check:
– SharePoint 2013 SPListItem method Update SystemUpdate and UpdateOverwriteVersion
– Export SharePoint 2013 List Items to Word Document using SharePoint Server Side Object Model
– Get SharePoint Features using PowerShell in SharePoint 2013
Here in this example we will try to retrieve the user profile picture url from User Information List using 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.