Link to home
Start Free TrialLog in
Avatar of greenshoots
greenshoots

asked on

Assign manager in ms graph - nothing happens

Having the challenge to get the set manager to work.
https://docs.microsoft.com/en-us/graph/api/user-post-manager?view=graph-rest-1.0&tabs=http
The permissions are right in my app as long as I have understood.
The app also has the Company Administrator and the Helpdesk Administrator role.
If those roles also have User.ReadWrite.All, Directory.ReadWrite.All everything should be alright?

In Powershell it works (but in another authentification context of course)
Set-AzureADUserManager -ObjectId $user.ObjectId -RefObjectId $manager.ObjectId
Then I can see the Manager with get-AzureADUserManager -ObjectId $user.ObjectId

PUT https://graph.microsoft.com/v1.0/users/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz/manager/$ref
Content-type: application/json
Content-length: 92

{"@odata.id": "https://graph.microsoft.com/v1.0/users/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}


Content-length is the length of the JSON string, and I calculate it with strlen in PHP. I hope that's correct.

But this gives me no response. Which is normal, I guess. But nothing happens actually. If I enter a wrong email or wrong format in the input, I get a related error message. So a part of it works. But not the set stuff.
ASKER CERTIFIED SOLUTION
Avatar of greenshoots
greenshoots

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of greenshoots
greenshoots

ASKER

The manager was added but in the oposite direction. So the user became a manager and the manager became a worker.