SharePoint Online - Enable Direct Download instead of Opening document when clicking on link

I have a SharePoint document library. Currently, when I select a document , click on "Copy Link" and share the link to users, when user clicks on link, document opens either in Office web apps or Client application depending on library settings. (Copy Link is with setting "Anyone with access can view the document") Instead, is it possible, to restrict opening this so that when user clicks the link, it directly gets downloaded?

asked Apr 16, 2018 at 4:45 2,215 4 4 gold badges 16 16 silver badges 39 39 bronze badges this works in Chrome, but not IE. any thoughts? Commented Jul 24, 2019 at 21:01

6 Answers 6

the https://SITE.sharepoint.com/:x:/r/sites/SITENAME/FOLDERNAME/FILENAME.EXT will work if you are logged in, but for anonymous users just add &download=1 at end of url (or ?download=1 )

answered Feb 19, 2020 at 0:17 41 1 1 bronze badge

This has the advantage to working for the users as well - if someone sends you an URL you can add this to download.

Commented Sep 30, 2020 at 16:14

Append following URL before your document copy link URL. It will allow users to only download the document.

http://sharepointSiteURL/_layouts/download.aspx?SourceUrl=http://DocumentCopyLinkUrl 

You can either do it manually or do customization in your view to have such URL.

Update:

Try following customization using CSR for generating downloadable link.
Try it out, if it works in SharePoint-Online.
If it doesn't work try modifying URL as answered by @Anthony Wang MSFT

  1. In your document library, create a column (Single Line of Text) with name say "DownloadLink".
  2. Create a js file and put following CSR code and Save it (e.g. in Site Assets with name as DownloadLinkScript.js)

(function () < function registerRenderer() < var ctxObj = <>; ctxObj.Templates = <>; ctxObj.Templates = < Fields : < 'DownloadLink': < View : function (ctx) < var siteUrl = _spPageContextInfo.webAbsoluteUrl; var url = String.format('/_layouts/download.aspx?SourceUrl=', siteUrl, (siteUrl + ctx.CurrentItem.FileRef)); return String.format(' ', url, ctx.CurrentItem.FileLeafRef); > >, > >; SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxObj); > ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js'); >)(); 
~siteCollection/SiteAssets/DownloadLinkScript.js