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 / get all direct reports...
Power Apps
Unanswered

get all direct reports filter disabled users

(0) ShareShare
ReportReport
Posted on by 303

I'm trying to to build a contact list where a user can select a site, and powerapps displays all of the managers direct reports, and then the direct reports of all those users. 

I'm having a problem where lots of disabled users are showing so have tried to add some filters. 

For some reason the second table created in the forAll has 6 blank rows?

 

 

ClearCollect(
 colMyDirectReports,
 Office365Users.DirectReportsV2(First(Manager3).Mail).value
);

ClearCollect(
 colMyDirectReportsEnabled,
 Filter(
 colMyDirectReports,
 accountEnabled = true
 )
);

ForAll(
 colMyDirectReportsEnabled,
 Collect(
 colMyDirectReports2,
 Office365Users.DirectReportsV2(mail).value
 )

);

 

 

Categories:
I have the same question (0)
  • rzuber Profile Picture
    545 Moderator on at

    Try

     

    ClearCollect(
     colMyDirectReports,
     Filter(
     Office365Users.DirectReportsV2(First(Manager3).Mail).value,
     accountEnabled
     )
    )

     

  • nick9one1 Profile Picture
    303 on at

    Thank you. that seems to work. But I still get an error. 

    this is my code for getting direct reports for 3 levels of hierarchy. 

    ClearCollect(
     colMyDirectReports,
     Filter(
     Office365Users.DirectReportsV2(First(Manager3).Mail).value,
     accountEnabled
     )
    );
    ForAll(
     colMyDirectReports,
     Collect(
     colMyDirectReports2,
     Filter(
     Office365Users.DirectReportsV2(mail).value,
     accountEnabled
     )
     )
    );
    ForAll(
     colMyDirectReports2,
     Collect(
     colMyDirectReports3,
     Filter(
     Office365Users.DirectReportsV2(mail).value,
     accountEnabled
     )
     )
    );
    
    ClearCollect(allStaff,colMyDirectReports);
    Collect(allStaff,colMyDirectReports2);
    Collect(allStaff,colMyDirectReports3)

    The table is populated, but I get this error. 

    Office365Users.DirectReportsV2 failed: The function 'DirectReportsV2' has an invalid value for parameter 'id'
    a blank value was passed to it where it was not expected. Please make sure that a valid argument is passed to the function.

     

    looking at the table it seems there are some nested values;

    nick9one1_0-1718700412426.png

     

    clicking any of the tables in the Value column shows nested list of users. 

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard