I was unable to update any of the following user properties(SharePoint Online): aboutMe, birthday, hireDate, interests, mySite, pastProjects, preferredName, responsibilities, schools, skills. With other user properties in one request. Following the documentation.
https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http
For example:
public async Task UpdateUserTask(string userId)
{
User user = new User
{
AboutMe = "Im dev",
GivenName = "Some One"
};
var _graphClient = GetGraphServiceClient();
await _graphClient.Users[userId].Request().UpdateAsync(user);
}
Implementation of GetGraphServiceClient:
private GraphServiceClient GetGraphServiceClient()
{
string tenantId = "{myTenantId}";
string clientId = "{myClientId}";
string clientSecret = "{myClientSecret}";
string[] scopes = new[]
{
"https://graph.microsoft.com/.default",
};
TokenCredentialOptions options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
ClientSecretCredential clientSecretCredential = new ClientSecretCredential(
tenantId, clientId, clientSecret, options);
return new GraphServiceClient(clientSecretCredential, scopes);
}
Response:
Code: BadRequest.
Message: The request is currently not supported on the targeted entity set
Although if you update these properties separately, they are successful updated (AboutMe and GivenName)
What I have:
API permissions for writing and changing data:
- Directory.ReadWrite.All,
- Sites.ReadWrite.All (for set SharePoint Online props),
- User.ReadWrite.All.
- Full premissions
And global admin rule.
Is there a way to update these properties using a single request?
I will be grateful for any answer :)
If you make the same query in Microsoft Graph Explorer, the result will not change
https://graph.microsoft.com/v1.0/users/{userId}
{
"aboutMe": "Im dev",
"givenName": "Someone"
}