I have a screen with Gallery1.
Gallery1 - Items is doing a top 100 search of Office 365 Users.
This search goes across multiple entities. This effort only requires the users to see contact information for employees in the same entity in-which they reside.
Let's use the National Football League as an example. The below is pulling at all contacts in the NFL system; however, in Gallery1 we only want to see the emails for members in the 'NFC West'; how do I make that happen?
I currently have the following in the Items of the Gallery:
If(!IsBlank(Trim(TextSearchBox1.Text)), Office365Users,SearchUser({searchTerm: Trim(TextSearchBox1.Text), top: 100}))
Solved! Go to Solution.
Hi @Phineas
For better performance, We can store user email on the variable when the app starts and use the variable instead of accessing User().Email many times.
Set App OnStart
Set(UserEmail, User().Email)
and use the variable
With(
{
_SearchUser: Office365Users.SearchUser(
{
searchTerm: If(
!IsBlank(Trim(TextInput3.Text)),
Trim(TextInput3.Text),
""
),
top: 100
}
)
},
Filter(
_SearchUser,
Last(
Split(
UserEmail,
"@"
)
).Result in Mail
)
)
@Phineas - If 'NFC West' is stored in one of the user object parameter of the Office365 users connector, add a filter condition to your code to filter members using that parameter. In the example below, I'm filtering users by Department rather than the full AD.
Filter(Office365Users.SearchUser({ searchTerm: TextInput2.Text, top: 500 }),Department= "Technology")
https://docs.microsoft.com/en-us/connectors/office365users/#get-user-profile-(v2)
Sir, thank you for you reply.
Unfortunately, "NFC West" is not stored.
I hoping to be able to isolate the members by their email addresses.
Assuming the entity as a whole have four divisions and each employees internal email was based on their division?
For example: The company is the "The Great Briar Patch"; the North division lead is Peter Rabbit at Peter_Rabbit@GPBNorth.com; however, the South division lead is Bugs Bunny @ Bugs_Bunny@GBPSouth.com
In my search as the administrator at GBP I am creating a Power App for the Sout division employees only, is there a way to rewrite the below to filter the active directory to return only the contact information for members from the South division to choose from rather than all members?
If(!IsBlank(Trim(TextSearchBox1.Text)), Office365Users,SearchUser({searchTerm: Trim(TextSearchBox1.Text),
top: 100}))
Hi @Phineas
The below code search user and withing the domain based on the email like GPBNorth or South
With(
{
_SearchUser: Office365Users.SearchUser(
{
searchTerm: If(
!IsBlank(Trim(TextInput3.Text)),
Trim(TextInput3.Text),
""
),
top: 100
}
)
},
Filter(
_SearchUser,
Last(
Split(
User().Email,
"@"
)
).Result in Mail
)
)
Hi @Phineas
For better performance, We can store user email on the variable when the app starts and use the variable instead of accessing User().Email many times.
Set App OnStart
Set(UserEmail, User().Email)
and use the variable
With(
{
_SearchUser: Office365Users.SearchUser(
{
searchTerm: If(
!IsBlank(Trim(TextInput3.Text)),
Trim(TextInput3.Text),
""
),
top: 100
}
)
},
Filter(
_SearchUser,
Last(
Split(
UserEmail,
"@"
)
).Result in Mail
)
)
It took everything except the 'UserEmail' at the end. I changed that to 'Mail', the errors went away.
However, this still returns ALL names and emails, not just the ones I seeks.
Old eyes!
I finally typed it correctly.
It works, Thank you!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
177 | |
52 | |
41 | |
36 | |
27 |
User | Count |
---|---|
243 | |
81 | |
71 | |
69 | |
66 |