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 Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
{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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.