When paging for the request https://graph.microsoft.com/v1.0/users?$top=999 the same user might appear on one and then the next page

EgorM 21 Reputation points
2022-08-19T17:05:18.757+00:00

When paging for the request https://graph.microsoft.com/v1.0/users?$top=999 the same user might appear on one and then the next page. Happens on rather large tenants.
Is it expected behavior or bug in Graph?

Thank you!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,912 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 43,976 Reputation points
    2022-08-19T17:33:02.363+00:00

    That is entirely possible. You didn't specify how you're actually paging but I'm assuming you're using the returned nextLink value. Users aren't "frozen" during enumeration so depending on the ordering it is possible to get back the same user on multiple pages because of changes in the user list. Note that the next link should have a skip token which should ultimately reduce the likelihood of this happening as it generally (based upon other APIs) is an encoded version of the query that the server uses to fetch the next set of results. However if you change any data going into the search then this invalidates it. Even then though it is possible to have dups. But ideally if you could provide us a repro so we can see what you're doing and the results you're getting it would be easier to identify if you're doing something wrong.

    Personally I would use Graph Explorer and run the same query. If you get dups across pages then the API is returning dups. If it doesn't return dups then it is more likely your code.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful