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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / 365 User list based on...
Power Apps
Unanswered

365 User list based on .City

(0) ShareShare
ReportReport
Posted on by 85

Hello,

 

I am trying to build a very simple "Phone list" but since we are a huge organisation, if I use

"Item" =

 

 

 

Office365Users.SearchUser({searchTerm:EmployeeTxt.Text;top:10})

 

 

 

for Vertical Gallery, I get all the listings found in our 365 network which looks up people from all over the world.

 

I would like to filter based on the .Country or .City parameter but I can't seem to find a working syntax for that. I just begun with the Power Apps so sorry for lame question.

 

Also:

Is it possible to List out all the people that fulfill the filter criteria in default without a search input? Ex. if the search bar is empty, list everyone with .City="Praha"

 

Thank you very much,

Jan

 

Categories:
I have the same question (0)
  • JanDras Profile Picture
    85 on at

    Ok, so I have managed to create the filter() syntax to work correctly but now when the search field is blank, the gallery shows zero results

     

    Filter(Office365Users.SearchUser({searchTerm:EmployeeTxt.Text;top:200});AccountEnabled=true;CompanyName="POCR")

     

    So I need help with the part two: How to get the gallery to show all the people with CompanyName="POCR" if IsBlank(EmployeeTxt)

  • JanDras Profile Picture
    85 on at

    So I tried to come up with some conditions, for example:

    If(IsBlank(EmployeeTxt.Text);
    Filter(Office365Users.SearchUser({top:200}); AccountEnabled=true; CompanyName="POCR");
    Filter(Office365Users.SearchUser({searchTerm:EmployeeTxt.Text; top:200}); AccountEnabled=true; CompanyName="POCR"))

     

    But once the search bar is empty, no people are shown. Once I start typing, it shows only people with the "CompanyName="POCR" so this atribute is not empty.

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on at

    Hi @JanDras ,

     

    I have tested your formula and it runs correctly.

    Filter(Office365Users.SearchUser({searchTerm:EmployeeTxt.Text;top:200});AccountEnabled=true;CompanyName="POCR")

    In my test, the gallery will not show no zero results when the search field is blank. Could you provide more detailed information, such as the settings of the EmployeeTxt control? Whether the Default property is set to blank?

     

     

    Best Regards,

    Habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • JanDras Profile Picture
    85 on at

    Hello @v-zhoqian-msft ,

     

    thank you for your answer. The default property of EmployeeTxt is indeed blank (there's nothing in the line). I have also tried to use "" but that didn't help either.

     

    Could you try to simulate your result again with tens of thousands of lines? If I drop the CompanyName="POCR" I also do get results but it's basically lines of mess from all of the branches from all over the world that are inside our O365 network. What I understood is that there's a 999 lines output limit and none of these first 999 results have the atribute ComapnyName="POCR".  Only after I input 2-3 letters to the search box I start to get results.

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on at

    Hi @JanDras ,

     

    Yes, indeed it is. Limit of Office365Users. searchUsers output is 999.

    We can check whether the number of rows of the filter result is 0 in the formula.

     

    You could try the following formula:

    If(CountRows(
    Filter(Office365Users.SearchUser({searchTerm:EmployeeTxt.Text,top:999}),AccountEnabled=true,CompanyName="POCR"))=0,
    Filter(Office365Users.SearchUser({searchTerm:EmployeeTxt.Text,top:999}), AccountEnabled=true),
    Filter(Office365Users.SearchUser({searchTerm:EmployeeTxt.Text,top:999}),AccountEnabled=true,CompanyName="POCR"))

     

     

     

    Best Regards,

    Habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • JanDras Profile Picture
    85 on at

    Hello @v-zhoqian-msft ,

     

    Yes, the number of rows is =0, with your line of code I'm getting all of the junk (the if is true), therefore only AccountEnable=true is applied.

     

    But whenever I start typing to the search box, I am getting only CompanyName="POCR" results.

     

    I have added a list element to verify the "CompanyName" atribute and it indeed lists out "POCR" whenever look someone up.

     

    I also tried replacing CompanyName with domain based on this (I tried both, EndsWith() or ("@domain.com" in Mail) and yet I am getting 0 lines if the searchbox is empty and relevant results if I start typing in.

  • JanDras Profile Picture
    85 on at

    In my opinion the problem is related to an excesive amount of lines in the data source (The O365 Conneciton). Is there a way to limit the Office365Users connection first? -> I would first filter out the data right in the connection (or inside invisible element and then I would connect the gallery to source data from there.

    Or another option that comes in my mind is that we've got a local company Sharepoint where the access is given to a single user group "ALL". This group is also listed in Outlook if you send mail to this adress, it is delivered to everyone inside the company.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard