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 / Adding additional Offi...
Power Apps
Unanswered

Adding additional Office365Users attributes to a collection

(0) ShareShare
ReportReport
Posted on by 16

I currently have a page that users can enter search criteria into a text box and a gallery will show all Office365 users that match the criteria.  The gallery has the photo, DisplayName and Department.  I want to modify this gallery so that it only searches Office 365 users that have an email address in a list.

 

I put the list of email addresses into a collection using this:

ClearCollect(collection1,ShowColumns('[dbo].[vw_EmailAddresses]',"email_address"))

 

I tried this under Items for the gallery:

Sort(Filter(Office365Users.SearchUser({searchTerm:"", top:500}), Mail in collection1.email_address),DisplayName))

 

The problem is that this code only searches the first 500 users who are in the email list.  I want it to search all Office365 users and show who are in the list.  If I omit "top:500", then no results are returned.

 

EDIT: Forgot to mention that I want the gallery to be populated when the screen first opens.  Here is the full code I have under Items:

 

If(!IsBlank(txtSearch.Text),
Sort(Filter(Office365Users.SearchUser({searchTerm:txtSearch.Text}),Mail in collection1.email_address),DisplayName)
,Sort(Filter(Office365Users.SearchUser({searchTerm:"", top:500}), Mail in collection1.email_address),DisplayName)
)

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

    Hi @sjlee ,

    The reason why you met this problem is that:

    In default, the Office365.SearchUser() function could only retrieve 100 records.

    So if you do not add "top:500" in your formula, the Office365.SearchUser()  function only returns result of 100 records and  the related records are not the top 100.

    Here's a similar issue for your reference:

    https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Office365Users-SearchUser-only-returning-limited-results/m-p/283285

     

    Secondly, if you want gallery to be populated when the screen first opens, I suggest you set the clearcollect formula to the screen's OnVisible property.Then, when you loads this screen, the collection will automatically populate, the items in the gallery will also display.

     

     

    Best regards,

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard