This article provides a solution to an issue where some properties are indicated as null when you call the Microsoft Graph API memberOf.
Symptoms
When calling one of the following APIs that can return the list of groups and directory roles that a user is a direct member of, you see null values for all properties except the object type and ID in the JSON response:
GET https://graph.microsoft.com/v1.0/me/memberOf
GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/memberOf
Here's a sample JSON response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.group",
"id": "00000003-0000-0000-c000-000000000000",
"deletedDateTime": null,
"classification": null,
"createdDateTime": null,
"creationOptions": [],
"description": null,
"displayName": null,
"expirationDateTime": null,
"groupTypes": [],
"isAssignableToRole": null,
"mail": null,
"mailEnabled": null,
"mailNickname": null,
"membershipRule": null,
"membershipRuleProcessingState": null
}
]
}
Cause
When an application queries the membership that returns a directoryObject type collection, if it doesn't have permission to read a resource type, members of that type are returned with limited information. For example, only the object type and ID might be returned, and other properties are indicated as null. Complete information is returned for the object types that the application has permission to read.
For more information, see List a user's direct memberships and Limited information returned for inaccessible member objects.
Solution
To get complete information, configure at least the Directory.Read.All permission for your application.
Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
