Not able to download a file from OneDrive

百般思念 提交于 2020-01-15 09:41:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!