Reputation: 310
I'm trying to pull back a list of all users, my expected result would be approximately 20,000 users.
Graph appears to limit me to 1000.
The graph call
https://graph.microsoft.com/v1.0/users
returns 100, if I add $top to it I can get up to 999.
https://graph.microsoft.com/v1.0/users/?$top=999
The $top filter works as long as the value is < 1000.
Has anyone found a way or know of a way to get > 1000 users back in a list?
Upvotes: 4
Views: 4994
Reputation: 534
You will have to make multiple API calls incrementing the $skip parameter with each call.
https://learn.microsoft.com/en-us/graph/query-parameters#skip-parameter
Upvotes: 0
Reputation: 33132
This is because the results are paged. From the documentation:
Some queries against Microsoft Graph return multiple pages of data either due to server-side paging or due to the use of the
$top
query parameter to specifically limit the page size in a request. When a result set spans multiple pages, Microsoft Graph returns an@odata.nextLink
property in the response that contains a URL to the next page of results.
You need to follow the @odata.nextLink
URI until you reach the final page (which is simply a page without an @odata.nextLink
value).
Upvotes: 7