Reputation: 2048
Microsoft Graph API is not returning more than 100 object
I tried below query to get "memberof" details of a particular user. However it return only first 100 objects. However User is member of 210 groups. Could you please help me with correct query
https://graph.microsoft.com/v1.0/users/[email protected]/memberOf
GET https://graph.microsoft.com/v1.0/users/[email protected]/memberOf
Upvotes: 0
Views: 6527
Reputation: 354
You can use query parameters to customize responses - like so for example get the top 300 - this will return til 300 groups etc
https://graph.microsoft.com/v1.0/users/[email protected]/memberOf?$top=300
This is a quick and dirty way, since the memberOf method does not support all OData Query Parameters
https://learn.microsoft.com/en-us/graph/query-parameters
Upvotes: 0
Reputation: 637
Please have a look at this doc explaining how paging works in Microsoft Graph: https://learn.microsoft.com/graph/paging
It works the same with the /memberOf API
Upvotes: 1
Reputation: 53
The response should contain a "@odata.nextLink" field which can be used to retrieve the next page of the result. An example response could be:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/users/[email protected]/memberOf?$top=5&$skiptoken=X%2744537074090001000000000000000014000000B2B64E48AF94EB439F56F5A33CB75C9301000000000000000000000000000017312E322E3834302E3131333535362E312E342E32333331020000000000011C7FEE5EFEFA46459248691C529273D3%27",
"value": [
{ ... }
...
]
}
To retrieve all results we should keep following "@odata.nextLink" of each responses until the response does not contain a "@odata.nextLink" field.
Upvotes: 3