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.
@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 🙂
@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!
I have tried this as well, but got the same results.
@Anonymous @jfloresuh
Why not use V2 of the DirectReports connector? I think the one you are referring to is deprecated...
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?
@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."
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473