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 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 315

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
    552 Moderator on at

    Try

     

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

     

  • nick9one1 Profile Picture
    315 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard