Skip to main content
Added instructions to also adapt site within Sharepoint to the one your file is located in.
Source Link

I have used 'download=1' to direct download a public file in SharePoint. It is working fine but this is working for .docx, .xlsx & .zip files only, it is not working for images & .txt file. So i have used following option & it is working for all files.

Public URL: https://xxxxx.sharepoint.com/:f:/g/EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w?e=tPfJVv

you need to get file Unique id from this URL i.e. EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

and update URL to:

https://xxxxx.sharepoint.com/sites/Developer/_layouts/15/download.aspx?share=EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

You will also need to update the name of the Sharepoint site in the URL above (here: "Developer") to match the site your file is located in.

I have used 'download=1' to direct download a public file in SharePoint. It is working fine but this is working for .docx, .xlsx & .zip files only, it is not working for images & .txt file. So i have used following option & it is working for all files.

Public URL: https://xxxxx.sharepoint.com/:f:/g/EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w?e=tPfJVv

you need to get file Unique id from this URL i.e. EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

and update URL to:

https://xxxxx.sharepoint.com/sites/Developer/_layouts/15/download.aspx?share=EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

I have used 'download=1' to direct download a public file in SharePoint. It is working fine but this is working for .docx, .xlsx & .zip files only, it is not working for images & .txt file. So i have used following option & it is working for all files.

Public URL: https://xxxxx.sharepoint.com/:f:/g/EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w?e=tPfJVv

you need to get file Unique id from this URL i.e. EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

and update URL to:

https://xxxxx.sharepoint.com/sites/Developer/_layouts/15/download.aspx?share=EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

You will also need to update the name of the Sharepoint site in the URL above (here: "Developer") to match the site your file is located in.

Source Link

I have used 'download=1' to direct download a public file in SharePoint. It is working fine but this is working for .docx, .xlsx & .zip files only, it is not working for images & .txt file. So i have used following option & it is working for all files.

Public URL: https://xxxxx.sharepoint.com/:f:/g/EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w?e=tPfJVv

you need to get file Unique id from this URL i.e. EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w

and update URL to:

https://xxxxx.sharepoint.com/sites/Developer/_layouts/15/download.aspx?share=EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w