7

My company uses Office 365 with OneDrive. I uploaded an Excel file there and shared via "guest link".

Is it possible to generate a link which someone could use just to download the file without further authentication?

For automation purposes, I am thinking of simple scheme:

 wget https://acmeamce.sharepoint.com/personal/myname/.../blabla.xlsx
Sun
  • 6,480

3 Answers3

6

Thanks to finding out OneDrive for Business is actually a re-branded Sharepoint 2013 and an answer in Sharepoint@SE I managed to get a link for programmatic download of a document.

One way to achieve is to right click on the document in the web GUI and take the URL there. It didn't work for me as this URL required authentication, but...

Taking the prefix of the URL e.g.

 https://acmeacme.sharepoint.com/personal/myname/_layouts/15/download.aspx?SourceUrl=

and the "usual" URL generated as guest link

 https://acmacme.sharepoint.com/personal/myname/_layouts/15/guestaccess.aspx?guestaccesstoken=123123%3d&docid=123123

and concatenating them turned out to work like a charm:

wget https://acmeacme.sharepoint.com/personal/myname/_layouts/15/download.aspx?SourceUrl=https://acmacme.sharepoint.com/personal/myname/_layouts/15/guestaccess.aspx?guestaccesstoken=123123%3d&docid=12312
4

All I needed to do was change the Edit Link slightly. Just replace guestaccess.aspx with download.aspx.

wilsjd
  • 153
2

Just to add to this thread (which pointed me in the right direction - thanks!), when trying as described above I got a 403 FORBIDDEN message when trying to download, and a Office 365 login on pasting into a browser.

To resolve I copied the guestaccesstoken=... part of the second URL and made it a parameter of the first URL also.

This then authenticated fine and the download worked a treat.

Thanks! Steve