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)
)
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:
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,
User | Count |
---|---|
221 | |
99 | |
94 | |
55 | |
36 |
User | Count |
---|---|
273 | |
105 | |
104 | |
60 | |
60 |