MS Graph OData schema metadata for manager is a directoryObject instead of a graph.user

JustusNBB 1 Reputation point
2021-03-29T09:31:26.48+00:00

Introspection of the OData schema (e.g to convert to GraphQL) reveals the Manager's metadata to be insufficiently typed and not declaring any user properties.

Manually tending to the metadata before usage allows to workaround this:

Replace <NavigationProperty Name="manager" Type="graph.directoryObject"/> with <NavigationProperty Name="manager" Type="graph.user"/> in the data from https://graph.microsoft.com/v1.0/$metadata - then the me/manager query also returns user attributes for the manager of the queried user.

Refs MS Uservoice: https://microsoftgraph.uservoice.com/forums/920506-microsoft-graph-feature-requests/suggestions/37700059-add-manager-to-list-users-graph-api

Would you consider this a bug? Can I expect it to get fixed soon?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,301 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,106 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Dan Kershaw 416 Reputation points Microsoft Employee
    2021-03-31T13:27:14.307+00:00

    @JustusNBB Thanks for the question. The reason for this nav property being of type DirectoryObject (the base type for pretty much all objects in the directory services part of Microsoft Graph) is that a manager could also be an organizational contact. Please see https://learn.microsoft.com/en-us/graph/api/user-post-manager?view=graph-rest-1.0&tabs=http#request-body.

    Currently we have to use a base type in this kind of schema declaration - I don't think there's a (simple) way to indicate that this navigation property can be 2 or more specific types.

    Hope this helps,
    Dan.