Why does https://graph.microsoft.com/v1.0/sites need a blank search parameter to return a list of sites?

Taylor Reece 0 Reputation points

According to docs, you should be able to make a request to https://graph.microsoft.com/v1.0/sites and get a list of your Sharepoint sites back. Both in the Graph API explorer and with my own HTTP requests, this seems to always return an empty list.


However, if I add a blank search parameter (i.e. make a request to https://graph.microsoft.com/v1.0/sites?search=), I do get all of my sites back.


Is that a bug or a feature? Do you need to include an empty search parameter for other endpoints in the Graph API?

Thanks! Taylor

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,025 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,215 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 91,361 Reputation points MVP

    Well, according to the documentation, only application permissions are supported for that query, so it shouldn't even work in the Graph explorer. Not sure if bug, improperly documented feature or anything else, but I will ping few people as it's interesting to know the answer here :)

    0 comments No comments

  2. RaytheonXie_MSFT 29,116 Reputation points Microsoft Vendor

    Hi @Taylor Reece

    Per my research, https://graph.microsoft.com/v1.0/sites only support Application permission. So we are unable to call GET /sites in the graph explorer tool.

    User's image

    And in the search for sites document, this is a different endpoint with GET /sites. The endpoint support Delegated (work or school account). So we will get result in the graph explorer tool while GET /sites returns empty.

    User's image

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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.