Tag Archives: client

SharePoint 2013: Retrieving User’s Profile using Client Side Object Model


Using the SharePoint Client Side Object Model you can retrieve a specific user’s profile from SharePoint. I have put together a simple console application in Visual Studio and I have described each line of code below.

On the 1st line of code instantiate the ClientContext class by passing your site’s URL.

On the 2nd line I instantiate PeopleManager class which provides methods for operations on people in SharePoint.

On 3rd line I instantiate the UserProfilePropertiesForUser class by passing the client context, the user’s name and an array of strings containing the property names.

On the 4th line I use the GetUserProfilePropertiesFor method from the PeopleManager and passing it the UserProfilePropertiesForUser object I have created earlier on. This method will return a list of string values that we can use a foreach loop to iterate through the values.

var clientContext = new ClientContext("http://yoursite/");

var peopleManager = new PeopleManager(clientContext);

var userProfile = new UserProfilePropertiesForUser(clientContext, "domain\username", new[] {"FirstName", "AboutMe", "Manager"});

var profileProperties = peopleManager.GetUserProfilePropertiesFor(userProfile);


foreach (var str in profileProperties)