我正在嘗試將檔案上傳到特定的共享點站點。在此頁面中,我向我展示了如何將示例檔案上傳到用戶的 onedrive。但是,就我而言,我需要上傳到共享點。我正在嘗試使用此端點:
POST /groups/{groupId}/drive/items/{itemId}/createUploadSession
但是給我看這個錯誤回應:
{
"error": {
"code": "itemNotFound",
"message": "Item not found",
"innerError": {
"date": "2022-05-08T23:15:29",
"request-id": "ca4362ca-ff36-488c-80b1-9f82c3448cd5",
"client-request-id": "ca4362ca-ff36-488c-80b1-9f82c3448cd5"
}
}
這是卷曲:
curl --request POST \
--url https://graph.microsoft.com/v1.0/groups/{groupId}/drive/items/test.txt/createUploadSession \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{
"@microsoft.graph.conflictBehavior": "rename",
"description": "description",
"fileSize": 4,
"name": "test.txt"
}'
uj5u.com熱心網友回復:
您正在嘗試呼叫需要itemId但您發送檔案名而不是itemId.
POST /groups/{groupId}/drive/items/{itemId}/createUploadSession
另一種方法是指定檔案的路徑。item-path必須包含在請求正文中指定的專案的名稱。
POST /groups/{groupId}/drive/root:/{item-path}:/createUploadSession
// file system path using /drive/root:/path/to/file
POST /groups/{groupId}/drive/root:/path/to/test.txt:/createUploadSession
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/471480.html
