Missing and duplicated sites in paged search request

Jöran Malek 76 Reputation points
2021-10-06T13:37:15.887+00:00

I'm having issues with the Graph API not returning sites and mixing up paged results.
This query

GET https://graph.microsoft.com/v1.0/sites?search=*

Returns a list of some sites … with duplicates, and missing sites.

I have a continuous list of sites beginning with "es0001" up to "es1000", I used all @odata.nextLinks, with following result (not exhaustive):

es0086
es0090
es0090
es0100
es0105

I can confirm the missing sites do exist on tenant-admin.sharepoint.com (and Get-SPOSite returns these as well). In total I got 994 of those sites listed, that is 5 missing without accounting for duplicates … of which 693 were no duplicates. Or rather: 300 returned sites were duplicates of sites already returned by the API in a previous page (or duplicate on the same page), and didn't return those 300, now missing, sites.

I cannot understand how a paginated result is so screwed up to miss and return wrong information.

Adding $orderby=name makes this marginally better to not have as much duplicates, but there are missing sites still.

I would've uploaded some sample files, but this site fails with a 503 error upon uploading.

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

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-10-07T08:31:54.263+00:00

    Hi @Jöran Malek ,

    For the missing sites, you could try to get them with the endpoint GET /sites/{hostname}:/{server-relative-path}, see if you can retrieve them.

    And you could add the $top query parameter to specify the page size: https://learn.microsoft.com/en-us/graph/paging