1

I am writing a C# application where I have to update a user profile property. I am using the following code:

using (var clientContext = new ClientContext(serverUrl))
{
    var peopleManager = new Microsoft.SharePoint.Client.UserProfiles.PeopleManager(clientContext);

    var personProperties = peopleManager.GetPropertiesFor(targetUser);
    clientContext.Load(personProperties, p => p.AccountName);
    clientContext.ExecuteQuery();

    peopleManager.SetSingleValueProfileProperty(personProperties.AccountName, property, newValue);

    // the following line throws exception 'Method "SetSingleValueProfileProperty" does not exist.'
    clientContext.ExecuteQuery();                    
}

I receive a

'Method "SetSingleValueProfileProperty" does not exist'

exception, when executing clientContext.ExecuteQuery() the second time. If I do not use clientContet.ExecuteQuery(), the change of the previous line is not done.

What am I doing wrong?

1 Answer 1

2

Are you doing this on-premise? I'm not sure this is supported on-prem yet!

See details here:

What about on-premises?

Right now this capability was released only to the Office 365 side, but we are actively listening input from the customers and partners for following other actions. You can still continue using user profile web service in the on-premises deployments. It’s important to notice that even though this web service is deprecated, it is still fully supported for on-premises deployments as well. This statement is also valid for Office 365 Dedicated customers (different service than typical Office 365).

1
  • 1
    I believe this is the correct answer, probably OP uses CSOM v.16 against Sharepoint 2013 Apr 2, 2015 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.