List sites returns empty array

captain_atharv 511 Reputation points
2022-12-29T11:07:30.88+00:00

Hi,
I'm trying to list all sites using delegated access token. The API returns 200 status code but I can see empty array in response

Request: curl --location --request GET 'https://graph.microsoft.com/v1.0/sites' \
--header 'Authorization: Bearer xxxx'
Response: {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
"value": []
}

On decoding access token, I can see below scope
"scp": "ExternalItem.Read.All Sites.Read.All profile openid email"

Can someone help with this?

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. RajeshKumarMSFT 1,976 Reputation points Microsoft External Staff
    2022-12-29T13:54:12.593+00:00

    Hi @captain_atharv ,

    Hope you are doing well, thank you for reaching out to us.

    I am able to get all the sites from my tenant using delegated access token with the below endpoint.

    274844-image.png

    Please refer the below documentation for additional information :
    https://learn.microsoft.com/en-us/graph/api/site-list?view=graph-rest-1.0
    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.