Graph API - How to handle empty manager of CEO?

Grethler, Niklas (TIS, KIZ, IT) 40 Reputation points
2024-03-28T10:34:09.1766667+00:00

Hello,

I have the use case where I query the manager of a given user.

But when the given user is our CEO then I get an error, since he doesn't have a manager.

Because I want to avoid hardcoding his user to skip this query, what are the options to handle this scenario?

Are there any settings to make in Graph or in Azure AD?

How do you handle this scenario?

Best regards

Niklas

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,592 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,859 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,474 questions
{count} votes

Accepted answer
  1. Vasil Michev 95,341 Reputation points MVP
    2024-03-28T18:13:51.7866667+00:00

    Well your other option is to populate some "dummy" manager value for his account, which probably will not go well :)

    Just add an exception to your query/code.

    0 comments No comments

0 additional answers

Sort by: Most helpful