
Hi Everyone,
I have a staff directory app, and it is connected to our Office.com & MS Teams. I build the Org chart in the Exchange server ( Organization > Manager), but I can't add anyone for our CEO since he doesn't have a manager. Here's the issue, when I search and click on his name in the app, it throws an error that this user doesn't have a manager. Here's the code
ClearCollect(Employee, ThisItem);
ClearCollect(PreviousEmployee, Employee);
Clear(Manager);Collect(Manager, Office365Users.Manager(First(Employee).Id));
Navigate(OrganizationScreen, Fade)
Here's the error message:
Office365Users.Manager failed: { "status": 404, "message": "No manager found for the specified user.\r\nclientRequestId: 4ace4eff-4622-456e-a4c1-e75ccaf9ef35", "error": { "message": "No manager found for the specified user." }, "source": "office365users-eus.azconn-eus-01.p.azurewebsites.net" }
I thought of adding an IF statement or sth that it doesn't throw an error message for the CEO user.
Thanks,
Hi @Oeskandarian :
Firstly,let me explain why you encounted this problem.
If the target user does not have a manager, then there will be such an error, and this error cannot be eliminated. In addition, there is no other way to directly obtain whether the user has manage. Currently I think the only way is based on the user’s jobtitle Determine whether he has manage.
Secondly,the formula could be:
ClearCollect(Employee, ThisItem);
ClearCollect(PreviousEmployee, Employee);
Clear(Manager);
If(Office365Users.UserProfileV2(First(Employee).Id).jobTitle<>"CEO",
Collect(Manager, Office365Users.Manager(First(Employee).Id)));
Navigate(OrganizationScreen, Fade)
Best Regards,
Bof