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 / Display a User's Direc...
Power Apps
Answered

Display a User's Direct Reports Using an Email Address

(0) ShareShare
ReportReport
Posted on by 20

Hello, 

 

I am creating an app for enrolling in training courses. Some courses require the individual to be a manager. I have created a screen where the training or "admin" can verify that the person is enrolled by viewing their direct reports, however I cannot get the Office365Users.DirectReports function to work properly.

 

Here is how I have it set up:

 

On one screen, the admin can view everyone who is enrolled in a course in a gallery that is connected to a SharePoint list, with a field with the person's email address. The user enrolls through a form in the app and their information is populated with the Office365User.MyProfile() function when the user is logged in and completes the form, so I know the email address is correct. 

 

On a separate screen, the admin can view the individual selected from the gallery on the previous screen. I have created a gallery to view the individuals direct reports and the "items" formula is set up as Office365Users.DirectReports(ViewEnroll_Gallery.Selected.EmailAddress). The issue is I keep getting the following error: Office365Users.DirectReports failed: { "status": 404, "message": " No user found with the specified id."} I have tried several ways around this, but I keep getting the same error. 

 

Does anyone know what I am doing wrong, or suggestions for another way to accomplish this? I know the Org Browser template uses collections (I have tested the template with our AD data and it works fine), but I don't know enough about collections to set it up. 

 

Any help would be greatly appreciate!

 

Thanks, Jen.

 

 

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @jfloresuh 
    I would suggest by doing a short test.  Start by putting this code in the OnSelect property of a button.  Then click the button.  Make sure to use V2 and replace the manager name with something valid. 

    ClearCollect(
     colMyDirectReports,
     Office365Users.DirectReportsV2("managername@yourcompany.com").value
    )

     

    Now put this code in the Items property of the gallery showing individuals.  If it works, you know the code is good.  Restyle the gallery however you like.

    colMyDirectReports

     

    Then you can go back to the gallery showing managers and put this code in the OnSelect property.  When you click on the gallery item it will now show individuals on the next screen.

    ClearCollect(
     colMyDirectReports,
     Office365Users.DirectReportsV2(ViewEnroll_Gallery.Selected.mail).value
    )

     

    Finally, delete the button we created as a test.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • Community Power Platform Member Profile Picture
    on at

    @jfloresuh 

    I suspect it's something to do with the connector? I followed this example here and was able to get the list of DirectReports to work but still got the same error as you.

     

    I even used a button to create a collection of direct reports ie

    ClearCollect( colDirectReports, Office365Users.DirectReports(InfoAbout.Text))

    then used this collection as my Items property of the gallery and same outcome ie direct reports showed in gallery, still getting error.

     

    One for the MS-Mods I think?

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Anonymous @jfloresuh 

    Why not use V2 of the DirectReports connector?  I think the one you are referring to is deprecated...

  • jfloresuh Profile Picture
    20 on at

     I have tried this as well, but got the same results. 

  • jfloresuh Profile Picture
    20 on at

    @mdevaney This worked! Thank you so much!

     

    @Anonymous Give this a shot and see if it works for you. It worked for what I'm trying to accomplish!

  • Community Power Platform Member Profile Picture
    on at

    @mdevaney  Thanks for the suggestion mate but it didn't work for me. My guess is that the way our AD is setup may be the issue?

     

    @jfloresuh happy to see you got it sorted ... I can stop working on this now 🙂 

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard