API - Create user with reporting manager

Ayan Usmani 171 Reputation points
2022-08-26T06:46:46.213+00:00

While user creation using - https://graph.microsoft.com/v1.0/users API , how can we provide manager detail in request body.

I am passing "manager": "b76ba9a9-4e22-43fe-8f74-b0d809f19000" (Object ID of desired manager) in body and getting following error :

'message': 'Property manager in payload has a value that does not match schema.'

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. CarlZhao-MSFT 46,406 Reputation points
    2022-08-26T07:24:44.707+00:00

    Hi @Ayan Usmani

    You can assign a manager to a user only after it has been created.

    PUT https://graph.microsoft.com/v1.0/users/10f17b99-784c-4526-8747-aec8a3159d6a/manager/$ref  
    Content-type: application/json  
      
    {  
      "@odata.id": "https://graph.microsoft.com/v1.0/users/6ea91a8d-e32e-41a1-b7bd-d2d185eed0e0"  
    }  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Cristian SPIRIDON 4,486 Reputation points Volunteer Moderator
    2022-08-26T07:17:58.233+00:00

    Hi @Ayan Usmani ,

    To assign a manager to a user you have to use a different API. Please see following link for details:

    https://learn.microsoft.com/en-us/graph/api/user-post-manager?view=graph-rest-1.0&tabs=http

    Hope this helps!

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.