0

I am unable to update the birthday and hireDate properties for users in my directory.

The following request returns a 500 Internal Server Error

PATCH https://graph.microsoft.com/beta/users/[removed] HTTP/1.1 SdkVersion: Graph-dotnet-1.10.0 Authorization: Bearer [removed] Cache-Control: no-store, no-cache Content-Type: application/json; charset=utf-8 Host: graph.microsoft.com

{"hireDate":"1989-10-02T04:00:00Z"}

HTTP Response

HTTP/1.1 500 Internal Server Error Content-Type: application/json ...

Microsoft.Office.Server.Directory.DirectoryObjectUnauthorizedAccessException. Attempted to perform an unauthorized operation.

Azure AD App Permissions

Tre'Von McKay
  • 35
  • 2
  • 6

1 Answers1

0

According to your description, I assume you want update user's birthday or hireDate through the Graph API.

From the returned response, your permission was denied to update the user's profile.

We should add the following permission: 'Directory.ReadWrite.All'.

To do that, we should add the Directory.ReadWrite.All scope in your code when we request an accesstoken.

Keen Jin
  • 1,060
  • 1
  • 6
  • 8
  • So the screenshot in my last message shows that I have the Directory.ReadWrite.All assigned to my app and per the documentation at https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service#4-get-an-access-token app tokens will receive all pre-configured permissions when using the .default scope which my application does – Tre'Von McKay Sep 11 '18 at 15:23
  • According to your description, I have find the solution at [this document](https://stackoverflow.com/questions/39725485/failed-to-update-user-profile-with-microsoft-graph-api-via-rest-api/39911494#39911494). It show that `Cannot perform any CRUD operations on User other than updating user HD photo and extended profile properties for both Delegated and Application permission types.` – Keen Jin Sep 12 '18 at 06:33
  • I wonder if anyone from Microsoft can confirm because the link you provided is over 2 years old and I couldn't find that statement anywhere in the Microsoft Graph documentation. I did upvote your response though. Thanks – Tre'Von McKay Sep 13 '18 at 02:08
  • So, you can submit the feedback from [here](https://officespdev.uservoice.com/). If you have some solution, please post your answer – Keen Jin Sep 13 '18 at 02:25