question

alivedevil avatar image
1 Vote"
alivedevil asked MichaelHan-MSFT commented

Missing and duplicated sites in paged search request

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-sites-lists
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered MichaelHan-MSFT commented

Hi @alivedevil,

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://docs.microsoft.com/en-us/graph/paging

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I want to enumerate all sites, as I don't know which sites are available, and I don't want the user to manually type in thousands of sites.
Manually specifying the site is unfortunately no option.

0 Votes 0 ·

@alivedevil
I used to meet the similar issues for newly created sites. And after manually get the sites as I mentioned, they would appear in the list of all sites.

0 Votes 0 ·

Hi @MichaelHan-MSFT,

Is there any way we could report this issue so I can be fixed by Microsoft?

If not, then is there a way to detect if a certain site has subsites or not, this way we can avoid sending unnecessary, but costly requests to retrieve subsites for a site that has none?

0 Votes 0 ·

@AndiHoti-4093

It's the sync issue. We need to give ample amount of time to commit/reflect the data back.

For your new question, please post a new thread about it.

0 Votes 0 ·