web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Search term in Search ...
Power Automate
Unanswered

Search term in Search for Users v2 returns no values

(0) ShareShare
ReportReport
Posted on by

Dear all,

 

I'm trying to extract the list of users in my M365 Entra.

I'm using for that the Search for user connector which works out of the box fine.

 

Now I want to reduce the search to a specific domain to avoid typically getting external users in my list.

I therefore used the search term option of the connector.

 

Screenshot 2024-01-31 at 14.45.01.png

 

However when adding such condition, I do not get any users back anymore 😞

I tried asking copilot to build it for me but it does the same simply with example.com instead of my own domain.

 

Any idea why it does not work?

Many thanks in advance for your advises.


David

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Kazevil 

     

    One solution is to use graph API to filter the mail of users based on the domain. You need to use "Send an HTTP request" action under "Office 365 users" connector to perform filer operation. Here is the example.

     

    In this example I am filtering the users with "@gmail.com" as domain:

    ManishSolanki_0-1706777221423.png

    URI:

    https://graph.microsoft.com/v1.0/users?$select=*&$count=true&ConsistencyLevel=eventual&$filter=endsWith(mail,'@gmail.com')

     pls replace the actual domain in the above URI.

     

     

    Output:

    ManishSolanki_1-1706777489567.png

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • Suggested answer
    TasosTer Profile Picture
    2 on at
    The solution I've found was to use the action Send an HTTP request (in Office 365 Users) and query:
    /v1.0/users?$count=true&$filter=(externalUserState eq 'Accepted' or externalUserState eq 'PendingAcceptance') and createdDateTime ge @{body('Get_Last_Successful_Run_from_Sharepoint_(.txt)')}
    I also added a custom header "ConsistencyLevel:eventual" and content type "application/json".
    The way I designed it, it stores the last successfully run's date in a .txt in Sharepoint and then uses it on the next run to get the newly created users since the last run.
  • Suggested answer
    Tomac Profile Picture
    3,948 Moderator on at
    @Kazevil The Search Term must be a complete match with one of the fields it searches (display name, given name, surname, mail, mail nickname and user principal name). It will not match on a partial, the search is "equals" not "contains".
     
    To search based on partial field values, you'll need to use a Graph request as noted in @ManishSolanki's reply below.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard