Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Fire ‘Get Manager (V2)’ in Power Automate – Graph API is the New Boss!

Ellis Karim Profile Picture Ellis Karim 10,706 Super User 2025 Season 1

Fire ‘Get Manager (V2)’ in Power Automate – Graph API is the New Boss!



Funny cartoon of an office worker searching for their missing manager. The worker looks confused, holding a clipboard, while a sign on the manager’s empty desk reads ‘Manager Not Found.’ In the background, coworkers shrug or point to a ‘404’ sign, symbolizing missing data. A lighthearted illustration relevant to Microsoft Graph API and Power Automate workflows."

Fire ‘Get Manager (V2)’ – Graph API is the Boss Now!

Is Power Automate's "GET MANAGER (V2)" action failing you again? It’s time to 💥fire💥 your Manager and hire a new boss — MICROSOFT GRAPH API!

Do you need to look up a user’s manager in Power Automate? Many developers turn to the “Get manager (V2)” action from the Office 365 Users connector. But let’s be honest – this “manager” isn’t exactly reliable. If a user doesn’t have a manager set in Entra ID (formerly Azure AD), the action fails, breaking your flow and causing unnecessary headaches.

Why “Get Manager (V2)” is Problematic

When a user does not have a manager assigned in Entra ID, Power Automate throws an error and stops execution:

Power Automate error: Get Manager V2 action failed with 'Resource manager does not exist' or missing reference-property. Troubleshooting Microsoft Power Automate errors.
The Get manager (V2) action fails if a user does not have a manager assigned.

The “Get manager (V2)” action returns the following error:

Resource ‘manager’ does not exist or one of its queried reference-property objects are not present.
Power Automate error: Get Manager V2 action failed with 'Resource manager does not exist' or missing reference-property. Troubleshooting Microsoft Power Automate errors.
The “Get Manager” action fails if no manager is assigned to the user.

This means that you need to include extra error handling in your flows (like Try-Catch blocks) to prevent them from failing unexpectedly. Instead of handling these errors, an alternative solution is to use the Microsoft Graph API.

Screenshot of the TRY/CATCH block in a Power Automate flow. The Try/Catch blocks are used to handle "Get Manager (V2)" errors.
Try-Catch blocks used to handle “Get Manager (V2)” action errors.

An Alternative: Using Microsoft Graph API

Rather than using ‘Get manager (V2)’, we can use the “Send an HTTP request” action in the Office 365 Users connector to retrieve a user’s manager directly from Microsoft Graph API.

Power Automate: Send an HTTP request. Use it to construct a Microsoft Graph REST API request to invoke.

What is Microsoft Graph API?

Microsoft Graph API is a powerful and secure way to access Microsoft’s cloud services and data. It allows you to manage users, emails, files, calendars, Teams messages, and more across Microsoft 365, Entra ID (Azure AD), and other Microsoft services. In our case, we’ll use it to fetch a user’s manager without causing flow failures due to missing data.

Advantages of Using Graph API Instead of ‘Get Manager (V2)’

  • No failure if the user has no manager: instead of throwing an error, the response simply returns no manager data, allowing the flow to continue uninterrupted.
  • Better error handling: the flow won’t break even if manager data is missing.
  • No additional licensing required: The Office 365 Users “Send an HTTP request” action is a standard connector, avoiding any premium licensing costs.
  • More powerful: Allows access to many other Microsoft 365 services beyond just user management.

Limitations of the “Office 365 Users – Send an HTTP request”

While powerful, this action has certain limitations you need to be aware of:

  • Supported API Endpoints: It only supports Microsoft Graph API calls starting with /me or /users/. Attempts to access other endpoints will result in errors. See Microsoft Learn | Office 365 Users.
  • Permission Requirements: Some API requests may require specific permissions.
  • Alternative Connectors: If the “Office 365 Users – Send an HTTP request” action doesn’t meet your needs, consider using alternative connectors. The standard HTTP action offers more flexibility but requires a premium license. Evaluate both standard and premium connectors to determine the best fit for your workflow requirements.

Further reading: HTTP vs Send an HTTP Request in Power Automate and Types of Power Automate Licenses.

Building the Flow

The flow is very simple:

Power Automate flow for retrieving user manager details using Microsoft Graph API. Includes 'Get user profile (V2)' action, HTTP request, Compose, Condition check for empty manager data, and Scope branches for handling cases with and without a manager.
Power Automate flow to retrieve a user’s manager using Microsoft Graph API, handling cases with and without a manager.

Step 1: Add the “Get user profile (V2)” Action

Power Automate Get User Profile (V2) action screenshot – retrieve user details for user Tom.
Add the “Get user profile (V2)” action and specify the target user.

Step 2: Add the “Send an HTTP Request” Action

Power Automate: Add the Office 365 Users "Send an HTTP Request" action.  We will use it to construct a Microsoft Graph REST API request in the next step.
Add the Office 365 Users “Send an HTTP Request” action.

In the ‘Send an HTTP Request’ action, configure the following fields:

Power Automate Send an HTTP Request action configured to retrieve a user's manager from Microsoft Graph API using the Office 365 Users connector. The GET request expands the manager property to include id, displayName, and mail.

1
2
3
4
5
6
7
8
URI:
https://graph.microsoft.com/v1.0/users/<user-id>?$expand=manager($select=id,displayName,mail)

Method:
GET

Content-Type:
application/json

💡 Replace <user-id> with the user’s UPN (email) or Object ID.


The “Send an HTTP Request” action is configured to retrieve a user’s manager from Microsoft Graph API using the Office 365 Users connector. The GET request expands the manager property to include id, displayName, and mail. This request retrieves the manager’s details without causing a flow failure if no manager exists.

Response from the “Send an HTTP request” action

The screenshots below display response bodies from the “Send an HTTP request” action, demonstrating cases for users with and without a manager.

Power Automate Screenshot – Compose Action Outputs. If the manager property is missing, it means the user does not have a manager. If the manager property is present, the user has a manager.
Sample response body of a “Send an HTTP request” action showing users without a manager and a user with a manager.

If the user does not have a manager, the manager property will be absent. If the user has a manager, the manager property will be present.

Handling API Response in Power Automate

Step 3: Add a Compose Action to Extract Manager Details

A Compose action is used to extract and store the manager details retrieved from the Microsoft Graph API request:

Power Automate Compose action displaying the extraction of a user's manager details using the body('Send_an_HTTP_request')?['manager'] expression after querying Microsoft Graph API.
💡 The Compose action is used to extract and store the manager details. Pay attention to the expression!

1
body('Send_an_HTTP_request')?['manager']
Note the use of the question mark in JSON expresion: <br>body('Send_an_HTTP_request')?['manager']


The use of the question mark (?) operator in the JSON expression ensures that if a property does not exist, it returns null instead of causing an error. This helps prevent flow failures when data is missing.

If the manager property is missing, using ? allows the expression to safely return null rather than breaking the flow.

However, if the manager property is missing AND the question mark (?) operator is not used, the Compose action (or any other action referencing the missing property) will fail, triggering an error that stops the flow:

Power Automate JSON expression comparison – using a question mark (?) in body('Send_an_HTTP_request')?['manager'] prevents errors by returning null if the property does not exist.
If the manager property is missing AND the question mark (?) is not used, the flow will trigger an error!

To learn more about how the question mark (?) operator can help prevent flow failures, see How to Read and Query JSON in Power Automate (With Examples)


Step 4: Add a Condition to Check if a Manager Exists

Power Automate Condition action checking if the Compose output is empty using the expression empty(outputs('Compose')) to determine if a user has a manager.
Add a Condition to test if the manager property exists.

The Condition action checks if the Compose output is empty. If the user does not have a manager, the manager property will be absent and the output of the Compose action will be empty.

1
empty(outputs('Compose'))
Power Automate condition check screenshot – evaluates if the 'Compose' output is empty, directing flow based on user having a manager or not
The screenshot below shows the condition check that determines whether the Compose action’s output is empty.

  • If empty is TRUE → The user does not have a manager.
  • If empty is FALSE → The user does have a manager, and their details can be extracted.

Step 6: Extract the Manager’s Details

Power Automate flow screenshot – 'If no' branch capturing manager details (ID, display name, and email) using Compose action outputs.
If the user has a manager, use these expressions to extract the Manager’s details.

If the user has a manager, use these expressions to extract the Manager’s details:

  • User ID (UPN): outputs('Compose')?['id']
  • Display Name: outputs('Compose')?['displayName']
  • Email Address: outputs('Compose')?['mail']

Summary

Using Microsoft Graph API instead of ‘Get Manager (V2)’ provides a more reliable way to retrieve a user’s manager in Power Automate, reducing the risk of unexpected flow failures. A key advantage is that if no manager is assigned, the API simply returns no data instead of triggering an error, making the flow more robust and predictable.

Furthermore, by using JSON expressions with the question mark (?) operator, you can prevent flow failures when data is missing. This simplifies error handling and reduces the need for complex Try-Catch blocks.

While ‘Get Manager (V2)’ may still be suitable in some scenarios, the Graph API offers greater flexibility and reliability, especially when dealing with missing data. The best approach depends on your specific needs and flow requirements.

Further Reading

(1) Office 365 Users: Send an HTTP request: “Office 365 Users Connection provider lets you access user profiles in your organization using your Office 365 account. You can perform various actions such as get your profile, a user’s profile, a user’s manager or direct reports and also update a user profile.” (Microsoft Learn)

(2) Best practices for error handling in Power Automate flows: This module focuses on how to use Configure run after to help isolate errors. It also overviews the built-in error reports. (1) Office 365 Users: Send an HTTP request: “Office 365 Users Connection provider lets you access user profiles in your organization using your Office 365 account. You can perform various actions such as get your profile, a user’s profile, a user’s manager or direct reports and also update a user profile.” (Microsoft Learn)

(3) How to Read and Query JSON in Power Automate (With Examples): This post illustrates through examples JSON notation that often confuses beginners. You will learn how to read and query JSON values and stop your flows from throwing errors! (Ellis Karim’s Blog)

(4) Types of Power Automate Licenses: provides an overview of the various licensing options available for Power Automate. (Microsoft Learn)

(5) Power Automate HTTP action: This built-in action makes an HTTP call to the specified URL for an endpoint and returns a response. (Microsoft Learn)

(6) HTTP vs Send an HTTP Request in Power Automate: Understanding the differences between these actions and when to use them can help you optimize your workflows and reduce unnecessary expenditures on premium licenses. (Pieter Veenstra)


Comments