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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Get all users through Office 365 Users connector through Search for users (V2)

(1) ShareShare
ReportReport
Posted on by 78

I'm trying to retrieve all our internal users through the Office 365 Users connector using Search for users (V2) in Power Automate. I would like to display all the users with a @company.com emailaddress. When searching on @company.com or just @ I don't get any results. When searching on my own firstname.lastname@company.com I do get a result. I can't find any documentation on the search field of Search for users (V2). How does it exactly work? Can I use wildcards?

 

searchusers.png

 

 

 

I have the same question (0)
  • RobElliott Profile Picture
    10,276 Super User 2025 Season 2 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    The Search for Users searches a particular search term, for example a full email address, and unfortunately you can't use a wildcard with it to get back all users. https://docs.microsoft.com/en-us/connectors/office365users/ 

    Rob
    Los Gallardos
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

  • SBS Profile Picture
    78 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    Hi RobElliot,

     

    Thank you for your reply. When I leave the search term empty the connector returns all the users. The problem is that it only returns the first 1000 users and the rest gets paginated. If I could search on the domainname of the emailaddress the result would only be 450. I can search firstname.lastname@company.com but I cant search on company.com because this returns zero results.

     

    Kind regards

  • v-litu-msft Profile Picture
    on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    Hi @SBS,

     

    You could use the Get group members action of the Auzre AD connector, it will return all members of the Groups, also, if you want to get all the members in the tenant, you could get all groups ID to put into the Get group members, then append them into an array:Annotation 2020-01-01 143702.png

    Get Members of a group

    Annotation 2020-01-01 144821.png

    Get members of multiple Groups

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Verified answer
    SBS Profile Picture
    78 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    Thank you. I found a solution by just changing the pagination setting to 2000, leaving the searchbox empty and filtering the array to reduce the input to only real employee accounts. 

  • Community Power Platform Member Profile Picture
    on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    I am interested to know how you achieved that as I am trying to do a very similar thing.

    "changing the pagination setting to 2000 and filtering the array to reduce the input to only real employee accounts"

     

    Although tests succeed, I don't seem to get any data returned.

     

     

  • Lam01007 Profile Picture
    231 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    Click the "..." on the right hand corner of the Action,

    Turn on "Pagination" and enter your Threshold

     
  • Lam01007 Profile Picture
    231 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    Add image for your reference:

    page.png

  • draymond11 Profile Picture
    20 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    @SBS Thanks for this. Can you share how you filtered the array?

  • Michal Z.  Profile Picture
    147 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    @SBS How did you filtered the search to real employee accounts?

  • m3ngi3 Profile Picture
    725 on at
    Re: Get all users through Office 365 Users connector through Search for users (V2)

    Hi @draymond11 ,

    You could to this using the Filter Array action: Powerhouse_Power_Automate_Filter_array.png

     

    Expression in my filter = 

    @equals(item()?['AccountEnabled'], true)

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 788 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 452 Moderator

#3
developerAJ Profile Picture

developerAJ 302

Last 30 days Overall leaderboard