Skip to main content
Community site session details
Power Automate - Building Flows
Answered

Search for job title

Like (0) ShareShare
ReportReport
Posted on 9 Mar 2022 17:41:04 by 1,934 Moderator

Is it possible to search for a user's email based on his job title? I'm using Search for users (V2). It works fine when you use the person's name, but searching for Director returns [].

 

Thanks,

Anne

  • Verified answer
    annetoal Profile Picture
    1,934 Moderator on 22 Sep 2022 at 13:27:25
    Re: Search for job title

    After the step where you send the HTTP request to Sharepoint, parse the JSON of the output using this (I used the name Parse JSON for the connector, which you will see in the next step.)

     

    {
     "type": "object",
     "properties": {
     "d": {
     "type": "object",
     "properties": {
     "__metadata": {
     "type": "object",
     "properties": {
     "id": {
     "type": "string"
     },
     "uri": {
     "type": "string"
     },
     "type": {
     "type": "string"
     }
     }
     },
     "Alerts": {
     "type": "object",
     "properties": {
     "__deferred": {
     "type": "object",
     "properties": {
     "uri": {
     "type": "string"
     }
     }
     }
     }
     },
     "Groups": {
     "type": "object",
     "properties": {
     "__deferred": {
     "type": "object",
     "properties": {
     "uri": {
     "type": "string"
     }
     }
     }
     }
     },
     "Id": {
     "type": "integer"
     },
     "IsHiddenInUI": {
     "type": "boolean"
     },
     "LoginName": {
     "type": "string"
     },
     "Title": {
     "type": "string"
     },
     "PrincipalType": {
     "type": "integer"
     },
     "Email": {
     "type": "string"
     },
     "Expiration": {
     "type": "string"
     },
     "IsEmailAuthenticationGuestUser": {
     "type": "boolean"
     },
     "IsShareByEmailGuestUser": {
     "type": "boolean"
     },
     "IsSiteAdmin": {
     "type": "boolean"
     },
     "UserId": {
     "type": "object",
     "properties": {
     "__metadata": {
     "type": "object",
     "properties": {
     "type": {
     "type": "string"
     }
     }
     },
     "NameId": {
     "type": "string"
     },
     "NameIdIssuer": {
     "type": "string"
     }
     }
     },
     "UserPrincipalName": {
     "type": "string"
     }
     }
     }
     }
    }

     

    It will expose the email address. Store the email address in a string variable using this expression

     

    body('Parse_JSON')?['d']?['Email']

     

    You can then insert this variable into the email connector you're using to send the mail.

  • Verified answer
    Community Power Platform Member Profile Picture
    on 07 Apr 2023 at 22:23:36
    Re: Search for job title

    Great solution. 

  • Verified answer
    Expiscornovus Profile Picture
    32,169 Most Valuable Professional on 09 Mar 2022 at 23:02:16
    Re: Search for job title

    Hi @annetoal,

     

    In that case try the Send an HTTP request (preview) action from the Office 365 Groups connector. That one is still not premium 😁

     

    The URI is slightly different compared to my previous example. I have added a forward slash between users and ?, because of an issue @VictorIvanidze found in this thread:

    https://powerusers.microsoft.com/t5/Building-Flows/Power-Automate-O365-Groups-activities-Get-group-ID/m-p/1368027/highlight/true#M154400

     

    https://graph.microsoft.com/v1.0/users/?$select=userprincipalName,displayName,mail,jobTitle&$filter=jobTitle eq 'Director'

     

    differenturi_o365groups.png

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete