2017-04-07 14 views
2

從SharePoint網站列表我從這裏https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/sharepoint如何獲得使用圖形API測試版

我想列舉從默認的網站列表下面的文件。

  1. 得到siteId使用/sharePoint/site終點(正常工作)使用sharePoint/sites/{{siteId}}/lists
  2. 請求列表不與下面的消息

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

任何指針工作回報404

回答

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 ****" 
} 
+0

是的,我嘗試了ID屬性,我們有一個列表仍然得到404 – AbdulKareem

+0

什麼是完整的URL(當然不包括ID)? –

+0

我列出了包含beta API基礎url的問題 – AbdulKareem

0
sharePoint/sites/{{siteId}}/lists

{siteId}的部分實際上是3部分,域根網站ID,子網站的ID,用於例如,如果我有一個域contoso.sharepoint.com,用命名的網站root site ID爲123(它應該是一個GUID),並在名爲Klingon Site另一個子網站與145所以我最終{siteId} id爲contoso.sharepoint.com,123,145

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