Skip to main content
Community site session details

Community site session details

Session Id : 9yST7a6X1+SV9+pU2BAlS4
Power Apps - Building Power Apps
Answered

Display a User's Direct Reports Using an Email Address

Like (0) ShareShare
ReportReport
Posted on 2 Mar 2020 20:10:10 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:
  • Community Power Platform Member Profile Picture
    on 02 Mar 2020 at 21:56:55
    Re: Display a User's Direct Reports Using an Email Address

    @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 🙂 

  • jfloresuh Profile Picture
    20 on 02 Mar 2020 at 21:40:04
    Re: Display a User's Direct Reports Using an Email Address

    @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!

  • jfloresuh Profile Picture
    20 on 02 Mar 2020 at 21:30:46
    Re: Display a User's Direct Reports Using an Email Address

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

  • mdevaney Profile Picture
    29,987 Moderator on 02 Mar 2020 at 21:28:12
    Re: Display a User's Direct Reports Using an Email Address

    @Anonymous @jfloresuh 

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

  • Community Power Platform Member Profile Picture
    on 02 Mar 2020 at 21:17:13
    Re: Display a User's Direct Reports Using an Email Address

    @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?

  • Verified answer
    mdevaney Profile Picture
    29,987 Moderator on 02 Mar 2020 at 21:11:00
    Re: Display a User's Direct Reports Using an Email Address

    @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." 

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading started