MS Graph API for SharePoint

Vijetha Marinagammanavar 1 Reputation point Microsoft Employee
2020-10-29T14:48:39.983+00:00

I would like to know if we are doing it the right way but seeing access denied and empty result when using below API calls.

  1. When I execute https://graph.microsoft.com/v1.0/sites API
    I am getting empty result:
    {
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
    "value": []
    }
  2. When I execute https://graph.microsoft.com/v1.0/sites/root
    I am getting result:
    {
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites/$entity",
    "createdDateTime": "2013-12-23T14:54:12.67Z",
    "description": "",
    "id": "xxxx.sharepoint.com,292b9b4c-5126-460a-915b-fa3511631211,d7852db4-e891-4e0b-aa80-db96f0551caq",
    "lastModifiedDateTime": "2020-10-28T14:13:24Z",
    "name": "",
    "webUrl": "https://xxxx.sharepoint.com",
    "displayName": "Employee Home",
    "root": {},
    "siteCollection": {
    "hostname": "xxxx.sharepoint.com"
    }
    }
  3. When I execute: https://graph.microsoft.com/v1.0/sites/root/sites to get all sites under root
    I am getting Access denied:
    {
    "error": {
    "code": "accessDenied",
    "message": "Access denied",
    "innerError": {
    "date": "2020-10-28T17:37:04",
    "request-id": "22030e19-bce3-4308-86aa-xxxxxxxxxxx",
    "client-request-id": "22030e19-bce3-4308-86aa-xxxxxxxxxxx"
    }
    }
    }
    End goal is to be able to work with SharePoint List and list items.
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,997 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shiva Keshav Varma 401 Reputation points
    2020-11-06T11:22:07.657+00:00

    To get all sites in your tenant you need to be a global administrator and use the below call

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

    (If the reply was helpful please don't forget to upvote or accept as answer, thank you)

    1 person found this answer helpful.
    0 comments No comments

  2. Vijetha Marinagammanavar 1 Reputation point Microsoft Employee
    2020-11-07T03:36:59.63+00:00

    Did not help me resolve the issue

    0 comments No comments