首页 文章

如何使用graph api beta从sharepoint站点获取列表

提问于
浏览
3

我正在关注此处的文档https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/sharepoint

我想枚举默认网站的列表 .

  • 得到 siteId 使用 /sharePoint/site 终点(工作正常)

  • 使用 sharePoint/sites/{{siteId}}/lists 的请求列表不起作用返回 404 以及以下消息

{ "error": { "code": "itemNotFound", "message": "Requested site could not be found", "innerError": { "request-id": "34b1b51a-59ba-4c56-991a-319ffbe33005", "date": "2017-04-07T10:46:40" } } }

任何指针

2 回答

  • 1

    我假设您已确认此网站中有一个列表 . 如果您尝试从没有一个站点的站点获取列表集合,您将获得404 .

    更可能是你使用了错误的ID . 文档对 {site-id} 所指的属性有点含糊不清 .

    当您获取网站时,将同时存在 siteIdid 属性 . 你想要 id 属性 . 使用 siteId 将导致404 .

    {
        "createdDateTime": "",
        "description": "",
        "id": "**** Use this one ****",
        "lastModifiedDateTime": "",
        "name": "",
        "webUrl": "",
        "root": {},
        "siteCollection": {
            "hostname": ""
        },
        "siteCollectionId": "",
        "siteId": "**** Not this one ****"
    }
    
  • 1

    sharePoint/sites/{{siteId}}/lists {siteId} 的一部分实际上是3部分,域,根网站ID,子网站ID,例如,如果我有一个域 contoso.sharepoint.com ,一个名为 root site 的网站,ID为 123 (它应该是一个guid),另一个子网站在名为 Klingon Site 的id为 145 所以我的最终 {siteId}contoso.sharepoint.com,123,145

    应该像 contoso.sharepoint.com,fffdf23f-1234-1234-a744-17e2e196e777,1481eca1-4567-4567-8dbc-60c666ab3b8c

相关问题