簡體   English   中英

使用 Microsoft Graph API 從 SharePoint 在線獲取文件

[英]Get a file from SharePoint Online using Microsoft Graph API

在學習圖 API 時,我試圖使用 Microsoft Graph API 從 SharePoint 文檔庫中獲取文件。

我首先嘗試從https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com訪問文檔中的Documents

通過執行此 GET 請求:

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com/drive/root:/Test:/children

一切都很好,然后我嘗試從同一租戶內的另一個站點訪問文檔。 我告訴自己,在遵循 Microsoft 文檔時,這是相同的途徑。

我首先做了一個測試請求,以確保我可以首先訪問我的網站; 這就是我所做的;

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite

在執行該查詢時,我得到了200 OK響應。

其次,我嘗試訪問驅動器Documents ,這就是我所做的;

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive

再次一切正常。

然后我使用root關系,后跟目錄名稱,然后是children關系; 這是我的要求:

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive/root:/Test:/children

但是在執行時,我收到了Bad Request - 400 - 96ms

請幫忙。

謝謝

使用站點相關 url 指定特定站點時,我遇到了同樣的問題。

現在我改用 siteId 並且一切都按預期工作:

https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com,91a47a59-db5e-4d17-a689-479ee8905533,274459c9-4c96-42bf-9b96-838ffa387aaa/drive/root:/X:/children

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM