OneDrive direct download URLs for files and file versions

4.7k Views Asked by At

I am putting the question in two lines

Does OneDrive supports direct download URLs for files? Are URLs returned by OneDrive are same for mobile and web ? Does OneDrive returns file versions via rest API calls ?

Read below for more details.


I am building a standalone app which uses various OneDrive REST apis for different operations, e.g. upload/download/update/browse a document/folder. I have following needs which I am not able to accomplish based on readings from OneDrive rest api support page https://msdn.microsoft.com/en-us/library/office/dn659752.aspx.

  1. Direct Download URLs: I want to give user of my app a facility to directly downloading a file. I know currently 'link' property of file object gives a direct view URL which takes user to OneDrive account and from there user can download the file by clicking download button. I need a link for direct download of the file (such link when typed in a browser which has authenticated OneDrive session should directly prompt the download box.)
  2. Are direct view/download link different for browser and mobile cients?
  3. Versions: How do I get version numbers for files programmatically. I do not see version info in JSON objects returned via REST calls. [I have read in one of the post that versions are not supported ]

https://msdn.microsoft.com/EN-US/library/dn631834.aspx?f=255&MSPPError=-2147217396 This link shows a JSON representation of a file object.

1

There are 1 best solutions below

0
On
  1. Direct Download URL-
    See this link to download from URL Getting BLOB data from XHR request
    1. Yes view/download different for browser and mobile, see below to access download box.

hope you are trying to access some file from your download folder!!
If you, you can use url like this-

file:///storage/sdcard0/download/file-name.mp4  

This worked for me.