[英]Uploading a document from Windows Store App to a SharePoint 2013 document library
[英]How to get a drive ID from a SharePoint List (Document Library) for uploading files?
我希望能夠將文本文檔上載到SharePoint列表。 由於它實際上是一個文檔庫,我認為我應該像上載到雲端硬盤一樣上載文件。 我可以將文件上傳到網站的根目錄。 我可以獲得要上傳到的列表的ID。 但是,當我將其用作目的地時,Microsoft Graph API似乎不喜歡我提供的ID。 ListItem表示使用文檔庫時ListItems作為DriveItems公開。 如何將小文件上傳到SharePoint 。
我一直在用C#和GraphExplorer進行測試。 歸結為我的端點不正確。
使用Graph Explorer時,可以使用以下兩個查詢來查詢所有驅動器:
graph.microsoft.com/v1.0/sites/{siteid}/drives
該查詢顯示我要查找的驅動器名稱,並且顯示的ID與列表ID不同。 這向我表明文檔庫具有單獨的列表ID和驅動器ID。
狀態碼201(已創建):graph.microsoft.com/v1.0/sites/{siteid}/drive/items/ root :/testplaceholder.txt:/ content
狀態碼404(未找到):graph.microsoft.com/v1.0/sites/ {siteid} / drive / items / { listid }:/ testplaceholder.txt:/ content
狀態碼400(錯誤請求):graph.microsoft.com/v1.0/sites/ {siteid} / drive / items / { driveid }:/ testplaceholder.txt:/ content
誰能告訴我缺乏了解的地方,或者我可能搞砸了的地方? 抱歉,缺少代碼格式,無法在URL字符串上使用它。
回答:
使用我在上面的第一個查詢中找到的驅動器ID。
graph.microsoft.com/v1.0/sites/{siteid}/drives/{driveid}/root:/testplaceholder.txt:/content
將文件上傳到庫的示例端點。
https://graph.microsoft.com/v1.0/sites/siteid/drives/b!zEu8xWMaOU-BdU94l2XA7SAospdkDeREgpABeq2Ahp2VZN3js8mQTq_JU5kiCSsB/root:/test.txt:/content
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.