Microsoft Graph download file content returns 404

前端 未结 1 1302
囚心锁ツ
囚心锁ツ 2021-01-22 09:55

I tried to download a file with Grpah API.

Tested with API browser, https://graph.microsoft.io/en-us/graph-explorer#

Ran following request, got list of file/fold

相关标签:
1条回答
  • 2021-01-22 10:29

    It is not supported to perform request to https://graph.microsoft.com/beta/me/drive/items/<itemid>/content endpoint via Graph Explorer.

    The request sent to https://graph.microsoft.com/beta/me/drive/items/<itemid>/content endpoint via Grath Explorer is issued as a preflight request. The server responds with 302-Redirect but redirects are not allowed for preflighted requests due to CORS behavior.

    Here is a workaround on how to download a file

    The following drive item resource request:

    https://graph.microsoft.com/beta/me/drive/items/<itemId>
    

    returns @microsoft.graph.downloadUrl annotation which contains the actual link to file resource.

    Once the drive item resource is retrieved, perform another GET request to url from @microsoft.graph.downloadUrl to return the actual file.

    0 讨论(0)
提交回复
热议问题