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 Apps
Answered

Search for manager

(0) ShareShare
ReportReport
Posted on by

Hi - 

I have a very basic question (i think it is)

 I have a query to show all the Office365 users in a gallery. The formulae i have is Office365Users.DirectReports(Office365Users.SearchUser({searchTerm:txt_user_search})  - Where txt_user_search is a textbox where the user inserts a user. 

 

What i need do is have the user select a user, and then on the right side of the page show the persons manager and any people that may work below the slected user.

 

Is this possible?

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @vee_syes, it's possible.

     

    BUT...your formula is not going to work properly.  You are trying to get the direct reports of a table (the results of SearchUser).  The DirectReports function needs a user ID only - it can't take a table.

     

    You could however, consider your Gallery (let's call it Gallery1) to be the list of user by setting the Items to this:

        Office365Users.SearchUser({searchTerm:txt_user_search.Text})

     

    Then in another Gallery (let's call it gallery2) to list the direct reports you can set the Items property to:

       Office365Users.DirectReports(Gallery1.Selected.Id)

     

    As for who is the Gallery2 persons manager...well that would be the person selected in Gallery1 (Gallery1.Selected.DisplayName)

     

    Hope this helps.

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @vee_s ,

    Could you please share a bit more about your scenario?

    Do you want to display the magaer info and any people that may work below the selected user in right side of the screen?

    Based on the formula that you provided, I think there is something wrong with it. 

    I have made a test on my side, please take a try with the following workaround:

    Create a Tablet layout app on your side, and add two Gallery controls within it:1.JPG

     

    2.JPG

     

    3.JPG

    Set the Items property of the Gallery1 to following:

    Office365Users.SearchUser({searchTerm:TextInput1.Text})

    On your side, you should type:

    Office365Users.SearchUser({searchTerm:txt_user_search})

    Set the OnSelect property of the Gallery1 to following:

    ClearCollect(
    RecordsCollection,
    Office365Users.Manager(ThisItem.Id), Office365Users.DirectReports(ThisItem.Id)
    )

    Set the Items property of the Gallery2 to following:

    RecordsCollection

    Please check the attached GIF screenshot for more details:

     

    Best regards,

    Test.gif

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

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard