Skip to main content

How to Get a User's Manager in Power Automate

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

The Office 365 Users action Get manager (V2) returns a person's manager from Microsoft Entra ID. Give it the person's email in User (UPN), and the manager's Mail, name and job title become dynamic content for the rest of the flow.

Microsoft's Office 365 Users connector reference describes it: Retrieves the profile of the specified user's manager. Its User (UPN) takes a User principal name or id.

The example is the approval flow of the Overtime Timesheet app. When the person who logged overtime is their department's only approver, nobody else in the department can approve it, so the flow asks their manager.

Prerequisites​

Step 1: Add Get Manager (V2)​

Add an action, search for Get manager, and choose Get manager (V2) under Office 365 Users. The first time, the designer asks for a connection; select Sign in with the account the flow runs as:

The Create connection pane for Get manager (V2) with Create a new connection, Sign in to create a connection to Office 365 Users., and a Sign in button, next to the canvas

Step 2: Give It the Person​

Select User (UPN), open the dynamic content list, and search for Created By Email. Two actions offer one: Get the department, whose creator is whoever added the department, and the trigger, whose creator is the person who logged the overtime. Pick the trigger's:

The pane of the action, then named Get the employee's manager, with User (UPN) empty and marked 'User (UPN)' is required., and the dynamic content list searched for Created By Email, showing Created By Email under Get the department and, outlined, Created By Email under When an item is created or modified, Email address of the user who created this item.

In Code view, the value is the trigger's email:

Get the manager → User (UPN)
@triggerBody()?['Author/Email']

Name it without an apostrophe. I first named this action Get the employee's manager, as in these screenshots. The apostrophe broke the expressions that read its output, and publishing failed (Fixed: "The input parameter(s) of operation contains invalid expression(s)" in Power Automate). It's now Get the manager.

Step 3: Use the Manager's Details​

The manager's details are in the dynamic content list under the action's name: Mail, Display name, Job title and more. Here, the next action puts Mail into the variable the approval goes to:

The dynamic content list searched for Mail, with the Variables group showing ApproverEmails, then the group Get the employee's manager with Mail, outlined, and Nickname

Ask the manager → Value
outputs('Get_the_manager')?['body/mail']

The Result​

Daniel Brooks, the only approver for Radiology, logged his own overtime. The flow found no other approver, so the run took the branch with Get the manager:

The run view of the condition Check for other approvers: under True, Ask the other approvers was skipped; under False, Get the manager succeeded in 0.6s and Ask the manager succeeded

Its output was his manager's profile. Part of the body:

The body of Get the manager's output in the run: givenName Admin, id 00000000-0000-0000-0000-000000000000, jobTitle Managing Director, and mail admin@example.com

The approval went to that address, and the manager approved it (How to Respond to Approvals in Power Automate).

Common Mistakes​

MistakeWhat happensDo this instead
Created By Email of the wrong actionYou get the manager of whoever created that itemThe trigger's Created By Email
An apostrophe in the action's nameExpressions that read it break when you publishLetters and spaces only
Expecting everyone to have a managerSomeone at the top has noneDecide what happens for them

Troubleshooting​

SymptomLikely causeFix
The action fails in a runThe person has no manager in Entra IDSet one, or handle the failure
The wrong managerThe wrong person's email in User (UPN)Check the token's action
A connection prompt every timeNo connection yet for Office 365 UsersSign in once

FAQ​

What if the person has no manager?​

In Power Apps, the same lookup fails with Resource 'manager' does not exist for a person without one (Fixed: Office365Users.ManagerV2 Failed: Resource 'manager' Does Not Exist). Everyone in the example who approves overtime has a manager.

Does it need a premium license?​

No. Office 365 Users is a standard connector.

Conclusion​

Get manager (V2) takes a person's email in User (UPN) and returns their manager's profile, with Mail for anything that needs their address. Pick the right person's email, and name the action without an apostrophe.

Additional Resources​