Unable to assign manager using MS Graph

Harsha Jha 61 Reputation points
2025-06-03T16:59:16.28+00:00

I’m following the Microsoft KB article on assigning a manager to a user via Microsoft Graph API: https://learn.microsoft.com/en-us/graph/api/user-post-manager?view=graph-rest-1.0&tabs=http

However, whenever I use the following in the body of my HTTP request:


{
  "@odata.id": "https://graph.microsoft.com/v1.0/users/{managerID}"
}

I receive an error specifically related to the @odata.id field. "The input parameter(s) of operation 'updateManagerForGuestUserDetails' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'updateManagerForGuestUserDetails'."

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. SrideviM 5,630 Reputation points Microsoft External Staff Moderator
    2025-06-09T09:26:19.84+00:00

    Hello Harsha Jha,

    I understand you're trying to assign a manager using Microsoft Graph and encountering the error:

    "The input parameter(s) of operation 'updateManagerForGuestUserDetails' contains invalid expression(s)"

    This usually happens because Power Automate doesn't handle dynamic content properly when it's placed directly inside the JSON body, especially in the @odata.id field.

    Initially, I too got same error when I tried to assign manager using a variable directly in the body, as shown below:

    User's image

    To fix this, you can build the body as a complete JSON string using an expression. This avoids parsing errors during runtime. For the Body, use the following expression:

    concat('{\"@odata.id\":\"https://graph.microsoft.com/v1.0/users/', variables('ManagerUserID'), '\"}')
    

    User's image

    This ensures the entire value is treated as a valid JSON string. The URI can remain as is. With the correct object IDs and permissions, this should work without errors.

    User's image

    To confirm that, you can below API call in Graph Explorer and check the user's manager details:

    GET https://graph.microsoft.com/v1.0/users/userId/manager/
    

    enter image description here

    Hope this helps!


    If this answers your query, do click Accept Answer and Yes for was this answer helpful, which may help members with similar questions.

    User's image

    If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.


1 additional answer

Sort by: Most helpful
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2025-06-03T17:29:46.8366667+00:00

    You need to replace the actual objectID of the manager, for example:

    User's image

    1 person found this answer helpful.

Your answer

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