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 / Trying to get all user...
Power Apps
Unanswered

Trying to get all users for a dropdown with company name

(0) ShareShare
ReportReport
Posted on by 16

I'm trying to get all the users for a dropdown that have a certain company name. I've tried in Items:

Filter(Office365Users.SearchUserV2({searchTerm: "", isSearchTermRequired:"No"}).value,CompanyName = "CRE")

 

but it's not returning all the users. I'm out of ideas.

Categories:
I have the same question (0)
  • Jeff_VS Profile Picture
    18 on at

    Hi soc-sp
    Please check out Shane Young's video. Apparently, there are certain limitations or contrainsts which I believe is why you are not able to see all results.

  • soc-sp Profile Picture
    16 on at

    I got it to work, but now when I try to get the value of the drop down it's saying it's blank

    Distinct(Contractors,displayName)

    is my Items on the dropdown.

    This is on visible on my screen:

    ForAll(
     Filter(Office365Users.SearchUserV2({searchTerm:DataCardValue40.SearchText, isSearchTermRequired:"No", top:999}).value, CompanyName = "CRE"),
     Collect(Contractors, {
     displayName: DisplayName,
     email: Mail,
     dept: Department,
     jobTitle: JobTitle
     })
    )

    So why is 

    DataCardValue40.Selected.Value

    Blank?

  • Jeff_VS Profile Picture
    18 on at

    Not sure if this is what you are looking for?

    Here is an example of a manual collection created with dummy names. Collection results are added to a Gallery, same results are added to the Dropdown object and finally the last label value changes dynamically when name is selected in the dropdown.

     

    Button: On Select --> 

    ClearCollect(collectNames, {Name:"John"},{Name:"Marie"},{Name:"Steven"},{Name:"Max"},{Name:"Rachel"})

    Gallery: Items -->

    collectNames

    Dropdown: Items -->

    collectNames

    Label: Text -->

    Dropdown1.SelectedText.Value

     

    Jeff_VS_0-1712092627466.png

     

  • soc-sp Profile Picture
    16 on at

    SelectedText isn't an option. I'm combining two different data sources. App OnStart:

    ForAll(
     With({Items: Ungroup(ForAll(ITRequestOtherUsers,Person),"Value"),
     DistinctEmail:Distinct(Ungroup(ForAll(ITRequestOtherUsers,Person),"Value"),Email)},
     Sort(
     ForAll(DistinctEmail,First(Filter(Items,Email=Value))), DisplayName
     )
     ),
     Collect(Contractors, {
     displayName: DisplayName,
     email: Email,
     dept: Department,
     jobTitle: JobTitle
     })
    );

    And OnVisible on screen:

    ForAll(
     Filter(Office365Users.SearchUserV2({searchTerm:DataCardValue40.SearchText, isSearchTermRequired:"No", top:999}).value, CompanyName = "CRE"),
     Collect(Contractors, {
     displayName: DisplayName,
     email: Mail,
     dept: Department,
     jobTitle: JobTitle
     })
    );

    I'm trying to get the dept for the department field and job title, etc.

  • soc-sp Profile Picture
    16 on at

    SelectedText isn't an option. I'm combining two different data sources. App OnStart:

    ForAll(
     With({Items: Ungroup(ForAll(ITRequestOtherUsers,Person),"Value"),
     DistinctEmail:Distinct(Ungroup(ForAll(ITRequestOtherUsers,Person),"Value"),Email)},
     Sort(
     ForAll(DistinctEmail,First(Filter(Items,Email=Value))), DisplayName
     )
     ),
     Collect(Contractors, {
     displayName: DisplayName,
     email: Email,
     dept: Department,
     jobTitle: JobTitle
     })
    );

    And OnVisible on screen:

    ForAll(
     Filter(Office365Users.SearchUserV2({searchTerm:DataCardValue40.SearchText, isSearchTermRequired:"No", top:999}).value, CompanyName = "CRE"),
     Collect(Contractors, {
     displayName: DisplayName,
     email: Mail,
     dept: Department,
     jobTitle: JobTitle
     })
    );

    I'm trying to get the dept for the department field and job title, etc.

  • Jeff_VS Profile Picture
    18 on at

    Can you go into Variables and check whether collection "Contractors" has any data? It should populate data when you open your app since you have the code OnStart app.

     

    Jeff_VS_0-1712153008903.png

     

  • soc-sp Profile Picture
    16 on at

    I got it to work. But when I try to use distinct then it loses my dept, jobtitle etc. How do I make a distinct list, but retain all the columns?

  • soc-sp Profile Picture
    16 on at

    I was able to use GroupBy to make it distinct choices, but for some reason the code below to add to my collection is only returning 26 records even though there are like 300 employees.

    Filter(Office365Users.SearchUserV2({searchTerm:DataCardValue40.SearchText, isSearchTermRequired:"No", top:999}).value, CompanyName = "CRE")

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 96 Super User 2026 Season 1

Last 30 days Overall leaderboard