Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph API Some Users Missing

Things had been working fine since January until about two weeks ago when I noticed that a particular user was missing from the list returned by the request:

get https://graph.microsoft.com/v1.0/users

I can reproduce the problem by login in to Microsoft Graph Explorer at

https://developer.microsoft.com/en-us/graph/graph-explorer#

and entering the same request.

I asked our site administrator if he had changed anything about that user. He replied no. The only thing that I am aware of that changed is that new users have been added.

I find interesting that the number of users returned is exactly 100.

How can I get all the users?

like image 269
Juan Casse Avatar asked May 04 '26 14:05

Juan Casse


1 Answers

Data returned from Graph is paged and the default page size for Graph results is 100 records. In order to return all of the users, you will need to make requests for each page.

One of the properties returned by https://graph.microsoft.com/v1.0/users is be @odata.nextLink. This is a link to the "next page" of data.

For example:

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$skiptoken=AVeryLongTokenString",
"value": [
    {
        "id": "...",
        "displayName": "Some Name",
        "mail": "[email protected]",
        "mobilePhone": "...",
        "officeLocation": "...",
        "surname": "Name",
        "userPrincipalName": "[email protected]"
    },        

For complete details, please see Paging Microsoft Graph data in your app.

like image 188
Marc LaFleur Avatar answered May 07 '26 11:05

Marc LaFleur