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?

  • this works in Chrome, but not IE... any thoughts? – user85578 Jul 24 '19 at 21:01

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


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


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('{0}/_layouts/download.aspx?SourceUrl={1}', siteUrl, (siteUrl + ctx.CurrentItem.FileRef));
                            return String.format('<a href="{0}">{1}</a>', url, ctx.CurrentItem.FileLeafRef);
        ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js');
  3. Go to your document library view --> Edit Page --> Edit Web Part --> Miscellaneous --> JS Link. Add following URL in it and Click on OK and Save the page.

  4. Reload the page and you will notice there is a hyperlink in "Download Link" column with file name.

| improve this answer | |
  • Manually will be bit tricky as there are multiple users sharing links and not all of them are having SharePoint Developer/Administrator background. They are basically content managers. Any suggestions for customization methods as how it can be done please? – 404 Apr 16 '18 at 6:09
  • Also unfortunately the above link does not work for me. It throws error. – 404 Apr 16 '18 at 6:22
  • Update: The above link does not work with url generated from "Copy URL" command. If I manually append end to end path like SharePoint Site/DocumentLibrary/FolderName/DocumentName.Extension, then it would work. But again, non-sharepoint users will find it difficult to do so. – 404 Apr 16 '18 at 6:29
  • Thanks, the first link in your answer helped me. I only needed a single link updated on a landing page so that normal users are prompted to download a single file. Admins will still open the file in web-view when working in the source document library. – DRVR Apr 27 at 23:26

You can manually create below URL for directly download document using URL.

https://{SiteURL}/{library internalName}/{documentName}

if Documents inside folder then use below URL

https://{SiteURL}/{library internalName}/{folder DisplayName}/{documentName}
https://console.sharepoint.com/sites/TestSite/BulkTestDocLib/folder1/document.docx https://console.sharepoint.com/sites/TestSite/BulkTestDocLib/folder1/folder2/document.docx

Note: -

  • This Link not work after document rename or folder rename
  • This is only work for those user who have view/read permission
| improve this answer | |

When you copy the link , it will look like https://xxx.sharepoint.com/personal/username/_layouts/15/guestaccess.aspx?guestaccesstoken=ayx%3d&docid=xyz&rev=1

You have to do is replace the guestacces.aspx with download.aspx . It will look like :

| improve this answer | |

I usually download the document. Use Ctrl+J to go to Download section copy the URL from there and share the URL with whoever wants to download the document.

| improve this answer | |

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 )

I achieve it with the anonymous reply in this thread: https://techcommunity.microsoft.com/t5/sharepoint/links-to-sharepoint-documents-set-to-download/m-p/215062

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.