Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

get all direct reports filter disabled users

(0) ShareShare
ReportReport
Posted on by 259

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:
  • nick9one1 Profile Picture
    nick9one1 259 on at
    Re: get all direct reports filter disabled users

    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. 

  • rzuber Profile Picture
    rzuber 545 on at
    Re: get all direct reports filter disabled users

    Try

     

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

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,304

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard