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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Office365Users Connect...
Power Apps
Unanswered

Office365Users Connector - Company Directory

(0) ShareShare
ReportReport
Posted on by 6

Hi, 

 

I'm making a company directory App and would like to allow the user to see all users assigned to a certain department. My problem is I can only bring in 999 users (Office365Users_2.SearchUser({searchTerm:"", top:999})) but my company may soon surpass this limit. I am trying to find solutions to narrow my returned results down.

 

Ideally I would like to be able to utilize the searchTerm by searching for a Department but I know this is not possible according to the SearchUser documentation. Another option I've thought of is if I could insert a wildcard into the searchTerm and narrow my results by domain (e.g., "@website.com" vs "@website2.com". But I've had no luck with wildcards. I have tried pre-loading the user data into a collection but we are not quite over 999 so I can't test if this works or not.

 

Has anyone been able to successfully bring in over 999 users into their app at once? Either by utilizting collection pre-loading, searchTerm wildcards, or another solution I'm not aware of? 

 

Any help is greatly appreciated. Thanks!

Categories:
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @aaron_scheidler,

    Do you want to bring in over 999 users into your app at once using Office365Users.SearchUser() function?

    If you want to bring in over 999 users into your app at once using Office365Users.SearchUser() function, I afraid that there is no way to achieve your needs in PowerApps currently.

    The 999 is the maximum value of user records retrieved from Office365Users.SearchUser() function at once. The user @JonFrost has faced same issue with you, please check the response from Microsoft Employee @

     

     

  • aaron_scheidler Profile Picture
    6 on at

    Hi _ Kris Dai, 

     

    Thank you for your response!

     

    I have seen @JonFrost's thread before and have seen the pre-load method described in the blog you referenced. The one issue with pre-loading the way the blog states is, as far as I can tell, there is no unique numeric id field available to bring in using office365Users.SearchUser() function. the Id field that it does bring in is a mix of numeric and character string. 

     

    The method that I am currently employing is to:

     

    1) grab the first 999 records and store them into a collection, using: (ClearCollect(coll1, SortByColumns(Office365Users_2.SearchUser({searchTerm:"", top:999}), "Id", Ascending)))

     

    2) grab the last set of 999 records and store them into a collection, using: ClearCollect(coll2, SortByColumns(Office365Users_2.SearchUser({searchTerm:"", top:999}), "Id", Descending))

     

    3) combine the 2 collections together into one single collection (I realize this may double up records but I then group the collection to get rid of any duplicates and get unique values)

     

    The thing I am unsure of is if my method of Reversing the sort order actually pulls in the last 999 records or if it pulls in the first 999 records and then reverses that order. I can't test this because we do not have over 999 users yet. As far as I am aware, the SortByColumns is a delegable function but I am unsure if the Office365Users connection is delegable or not. 

     

    Would you have any insight if using SortByColumns on Office365Users is actually doing what I think it's doing? 

     

    Thanks for your input!

     

    -Aaron

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard