Unable to access the Sharepoint List using Microsoft Graph API--

后端 未结 3 1265
你的背包
你的背包 2020-12-18 07:26

Working with the Microsoft graph api and especially the sharepoint beta api and i am constantly running into issues. I know its beta, but still;)

SO the issue is Whe

相关标签:
3条回答
  • 2020-12-18 08:06

    @Ryan Gregg has the correct answer

    The SiteId is not just one GUID but a combination of <HostName,SPSite.ID,SPWeb.ID>.

    Example: <contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8>

    The whole string in the above example is what you should pass for {SiteId} in your request

    If you dont have the SPSite.ID but have the URL for the site, you can make a GRAPH API call with relative path to the site

    https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/Documetation
    

    This call will return all the properties for the site and you can grab the full SiteId from here:

    {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites/$entity",
        "createdDateTime": "2020-04-23T12:18:48.653Z",
        "description": "Documentation",
        "id": "contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8",
        "lastModifiedDateTime": "2020-12-09T19:17:21Z",
        "name": "Documentation",
        "webUrl": "https://contoso.sharepoint.com/sites/Documentation",
        "displayName": "Documentation",
        "root": {},
        "siteCollection": {
            "hostname": "contoso.sharepoint.com"
        }
    }
    
    0 讨论(0)
  • 2020-12-18 08:13

    Try https://graph.microsoft.com/beta/sites/{siteCollectionId},{siteId}/lists

    You can find these ids from https://graph.microsoft.com/beta/site/sites

    0 讨论(0)
  • 2020-12-18 08:18

    The format of the ID's for sites have changed as part of a set of updates to the API this week. The new format is documented here, but it includes the SharePoint hostname, SPSite.ID, and SPWeb.ID as a triplet:

    https://graph.microsoft.com/beta/sites/contoso.sharepoint.com,fc016e3c-d8ae-4ee0-a10c-de6d26788b6a,9a4ea7a5-c3c4-44ae-9f80-273bd67431b8
    

    If you add the hostname into your IDs, your calls should start working again. You can discover the hostname by making a request to:

    https://graph.microsoft.com/beta/sites/root/siteCollection/hostname
    

    You can also search for sites now using the following search syntax:

    https://graph.microsoft.com/beta/sites?search={keyword}
    
    0 讨论(0)
提交回复
热议问题