How to Get list of User Profile properties in Sharepoint 2013/2016 or Online using CSOM?

Hi SharePointers,

Here is the blog to get Get list of User Profile properties in Sharepoint 2013/2016 or Online using CSOM.

var spx= SharePointContextProvider.Current.GetSharePointContext(Context);

using (var ctx= spx.CreateUserClientContextForSPHost())
{
// Get the people manager 
PeopleManager peopleManager = new PeopleManager(ctx);
PersonProperties personProperties = peopleManager.GetMyProperties();
ctx.Load(personProperties);
ctx.ExecuteQuery();

output.Text = “”;
foreach (var results in personProperties.UserProfileProperties)
{
output.Text += string.Format(“{0} – {1}{2}”, results .Key, results .Value);
}
}

Happy SharePointing Folks !!

Leave a Reply

Your email address will not be published.