How to create a permanent download link to a OneDrive file

56 Views Asked by At

I want to create a permanent download link for an .xlsx file in OneDrive. First, I tried to create an embed and replace edit by download. Usually these links are of the form:

https://onedrive.live.com/edit?resid=441509D410716450%211231&authkey=!AK6J7i3GDd5Zbc8&em=2

However, the link to this file in the embed field was of the following form:

https://1drv.ms/x/c/592951b5e0f544a7/EadE9eC1USkggFmOCgAAAAAB4_jqZzrpD9T6AhTDFHA2Rg

So I tried expanding it with a link unshortener. This gave me a link that looked more like the first one. I applied the trick, but it gave me a page saying the file didn't exist or was unavailable. I noticed the link was missing the authkey part at the end though.

The second thing I tried was appending ?download=1 or &download=1 at the end of the link (or the end of what the link expands to), but this resulted in nothing except the page loading the file like normal.

I also found this SO thread saying you could create a permanent download link by converting the shortened share link to Base64. Using this method, I got a page displaying the following error:

{
  "error": {
    "code": "unauthenticated",
    "message": "The caller is not authenticated."
  }
}

The expanded share link also didn't include the authkey part.

How do I create a link that I can turn into a permanent download link? Or how do I create a permanent download link for this file? I don't have access to the MS Graph API since I don't own a work or school account.

0

There are 0 best solutions below