0

I want to download the content of a file in order to store it in local machine, the request I sent is:

https://graph.microsoft.com/v1.0/me/drive/root:/test/file1.docx:/content
get.addHeader("Accept", "application/octet-stream"),
get.addHeader('Authorization', authcode);
get.addHeader('Cache-Control', 'no-store');

the response code is 200 not 302. When I use my personal account the response header is jason object which has Content-Location (it is a download url). So far so good. But when I use business account, the response code is 200 but there is no downaloadurl/contentlocation/ or anything similar in the response header. All the permissions I think is fine, the scope in Azure is set to "Files.ReadWrite.All".

PS: I don't want to download the file, I want to download the filecontent. Any suggestions?

Update: looks like this is known issue, there is already a case for that https://github.com/microsoftgraph/microsoft-graph-docs/issues/5637

Mirana
  • 37
  • 1
  • 8

1 Answers1

0

Could you please share more detailed steps and screenshots?

I tested the API, everything is fine:

enter image description here


Another way is also mentioned in the github issue page:

We can get the @microsoft.graph.downloadUrl feom the metedata:

enter image description here

Jack Jia
  • 5,268
  • 1
  • 12
  • 14