Tuesday, February 13, 2018

How to properly use the “Get Manager” Flow action with a SharePoint list

A confident man in a blue blazer
Photo by Olu Eletu at Unsplash.

This is a short one and quite easy. When you create an item in SharePoint the unique identifier for a person field is the claim, while the Get Manager action takes a UPN (user prinipcal name).

image

For Office 365 they are almost equal. The claim is actually the UPN + a claim prefix.

UPN: john@contoso.com
Claim: i:0#.f|membership|john@contoso.com

If you have a flow triggering on a SharePoint list, you would enter the following expression for the UPN field to strip off the prefix from the claim.

replace(triggerBody()?['Editor']?['Claims'],'i:0#.f|membership|','')

image

Sure you can use the e-mail address which usually match the UPN, but you would be surprised how often multiple accounts have the same e-mail address - admin accounts, test accounts etc. So using a unique identifier is always a better approach compared to the e-mail address.