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
)
);
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;
clicking any of the tables in the Value column shows nested list of users.
Try
ClearCollect(
colMyDirectReports,
Filter(
Office365Users.DirectReportsV2(First(Manager3).Mail).value,
accountEnabled
)
)