Cef
Cef

Reputation: 929

MS Graph API Client UpdateAsync() method gives an error

When I attempt to update an object (in this particular case a user) using UpdateAsync(), I get the error:

    Message "Specified HTTP method is not allowed for the request target."  

But Intellisense for the method says it updates the specified User using PATCH, which seems right. Has anyone else experienced this error?

await _graphServiceClient.Users[u.Id].Request().UpdateAsync(user)

Is anyone aware of another syntax to achieve the same thing? I'm not married to this code ;)

enter image description here

Upvotes: 2

Views: 1109

Answers (1)

Hury Shen
Hury Shen

Reputation: 15734

Summarize the chat records, test with update one property of user in code and found the problem was caused by one of the property(Id) is null. It will show error message when the property Id is null.

So just add a line of code to avoid null Id be inserted during update operation.

Upvotes: 2

Related Questions