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 / Return a collection of...
Power Apps
Unanswered

Return a collection of everyone on my organization with a certain job title

(0) ShareShare
ReportReport
Posted on by 363

When I run this code it only returns a single name not all of the names.

 

ClearCollect(colVPElec, Filter(Office365Users.SearchUser(),JobTitle = "VP Engineering" ));

 

Afterwhich I want to additionally filter by department and get one name but right now I want to retrieve everyone with the VP Engineering job title

Categories:
I have the same question (0)
  • fnanfne Profile Picture
    260 on at

    Hi colbyturybury

     

    Wow that's weird! I thought of suggesting to filter outside of your collection, but I'm getting the same result. However, only with one specific job title. When I use other job titles, it works.

     

    Could you give that a go?

     

    So for example, in a gallery's Items property, add the filter like so...

    Filter(colVPElec, JobTitle = "VP Engineering")
  • colbyturybury Profile Picture
    363 on at

    I am generating the collection from a button press with my above code. It is communicating with Active Directory so I need to be using the Office365Users connector.

  • fnanfne Profile Picture
    260 on at

    I've just done some digging and it looks like the Office365Users connector only returns 100 results! Found this out by adding a label control with the following in the Text property

     

    CountRows(colVPElec)

     

    When I collect, it only shows 100. Hmmm

     

    I wonder if this limit can be increased, or the filtering done on Office365, before collecting in PowerApps?

  • fnanfne Profile Picture
    260 on at

    I managed to find a solution.

     

    Still filtering outside your collection, you can grab all staff (up to 999) with this

     

     

    ClearCollect(colVPElec, Office365Users.SearchUser({top:999}))

     

     

    Now, once you have this collection, you can filter.

     

    You may get the filter+collection in one go though I have not been successful with that

  • colbyturybury Profile Picture
    363 on at

    How do I only look for those with the Job Title, "VP Engineering"?

  • colbyturybury Profile Picture
    363 on at

    Got It!

     

    ClearCollect(colVPElec, Filter(Office365Users.SearchUser({top:999}),JobTitle = "VP Engineering" && Department = "Electrical").DisplayName)

  • fnanfne Profile Picture
    260 on at

    Like I always like to say; there are many ways to scratch a cat. 

     

    What I've done to test is to

     

    1) Create the collection of all staff (assuming the total staff is less than 1000!) using a button. Add this to the button's OnSelect property.

    ClearCollect(colVPElec, Office365Users.SearchUser({top:999}))

     

    2) Add a gallery and in its Items property, add the following

     

    Filter(colVPElec, JobTitle = "VP Engineering")

     

    I've added a dropdown with all the job titles, then you can select whichever job title you want from the dropdown, and then the gallery will update accordingly. Like this....

     

    Filter(colVPElec, JobTitle = Dropdown.SelectedText.Value)

     

    You can also add additional controls/dropdowns/Text fields, to further filter your collection.

     

     

  • fnanfne Profile Picture
    260 on at

    Nice one, it works!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard