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.
* GraphAPIAzure

Avatar of undefined
Last Comment
greenshoots

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
greenshoots

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
greenshoots

The manager was added but in the oposite direction. So the user became a manager and the manager became a worker.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes