Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Find user by other property than email or id with Power Automate

Posted on February 22, 2023February 22, 2023 by Tom

“I need to find a user by his job title but Power Automate keeps asking for email or id, how can I use his role property instead?”


When you’re looking for more information about a user, you probably use the ‘Get user profile’ action. You input the user email or his id, and it’ll return his whole user profile. But what if you don’t have his email nor user id? What if you’ve got e.g. his job title, or a unique user code in your organisation? How do you find such user?

Use an HTTP request via Graph API

Since the default action won’t help (unless you want to get all users and then filter with the ‘Filter array’ action) you’ll have to look elsewhere. And the place to look is an HTTP request.

You’re looking for a user, meaning the endpoint to call is /users.

Method: GET

Uri:
https://graph.microsoft.com/v1.0/users

But such request would give you all the users, you don’t want that. You want only the users that fit a condition, a filter in the format below:

https://graph.microsoft.com/v1.0/users?$filter=<property> eq '<value>'

While you might be tempted to use this request in the Office 365 Users action ‘Send an HTTP request’, don’t. At the time of this article it’s not working.

Use the ‘Send an HTTP request’ action from the Office 365 Groups instead.

Power Automate find user property

The response will be a JSON with all the users fitting the condition where you can extract the information directly with an expression.

Summary

When an action won’t help, use an HTTP request. While Power Automate has an action to get user profile, you can’t use it to find users using a different property than email or id. Luckily there’s a workaround by adding the filter directly into a request to Graph API. Add the $filter parameter, pick which property it should search in, and the value to look for.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

  • How to find Excel rows missing in SharePoint list (Power Automate)March 29, 2023
  • Check whether user exists in AAD with Power AutomateMarch 26, 2023
  • How to highlight whole SharePoint row based on calculated dateMarch 22, 2023
  • Why is your Power Automate flow running so slow?March 19, 2023
  • How to add multiple links to the Power Automate approval taskMarch 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes