问题
According to Microsoft Graph's documentation, the API to download file contents of a file in my OneDrive is:
/beta/me/drive/items/01UG2T5D6KU5GACQUPCFE3AMTN47BTTSA6/content
however it is returning
Failure - Status Code 0,
{
"isTrusted": true
}
If I just do
/beta/me/drive/items/01UG2T5D6KU5GACQUPCFE3AMTN47BTTSA6
it returns the correct file metadata - so this means the file exists so any clues why Graph cannot fetch the content
回答1:
You could use GET /drives/{drive-id}/items/{item-id}/content
Ref: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_get_content
If you're using Dotnet SDK for Graph, you could use
graphServiceClient.Me.Drive.Root.ItemWithPath(itemPath).Content.Request().GetAsync();
来源:https://stackoverflow.com/questions/51137121/not-able-to-download-a-file-from-onedrive