Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Query User Profile Data in SharePoint 2013 using Client Object Model returns null for all properties except Title

$
0
0

Hi,

I am trying to access user profile properties using Client Object Model in SharePoint 2013. But, when I am trying to get user properties, I am getting null for all except Title. User properties values are visible on user's site. Please let me know, if I am missing something.

namespace test

{

    class Program

    {

        static void Main(string[] args)

        {

           string siteURL = "http://mysite";

           string accountName = "testuser1";

    string userProfileProperty = "Email";

           ClientContext clientContext = new ClientContext("http://mysite");

    PeopleManager peopleManager = new PeopleManager(clientContext);

           ClientResult<string> profileProperty = peopleManager.GetUserProfilePropertyFor(accountName,userProfileProperty);           

           clientContext.ExecuteQuery();

          Console.WriteLine("Account Name: " + profileProperty.Value);         

           Console.ReadLine();

        }

    }

}

THanks,

Deepali


Deepali


Viewing all articles
Browse latest Browse all 25064

Trending Articles