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, 2019 at 21:01

6 Answers 6


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.

  • 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, 2018 at 6:09
  • Also unfortunately the above link does not work for me. It throws error.
    – 404
    Apr 16, 2018 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, 2018 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, 2020 at 23:26
  • 1) note that the site URL can be your subsite within your organization's main site, e.g. orgname.sharepoint.com/sites/yoursite/_layouts/download.aspx 2) In Microsoft Flow you can construct download link by having URL orgname.sharepoint.com/sites/yoursite/_layouts/download.aspx?Sourceurl= followed by file property 'Full Path'.. I used function Concat to build the download URL.. works perfect so far, just downloads in default download folder no questions asked.
    – Uttam
    Sep 30, 2020 at 4:57

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

  • This has the advantage to working for the users as well - if someone sends you an URL you can add this to download. Sep 30, 2020 at 16:14

Hi I found a solution online that couldnt be simpler, especially if you're using chrome as your browser.

In sharepoint simply choose the "download" option on the file you want the URL for.. chrome opens. Once it has downloaded, click on the chrome menus and choose "downloads", where you'll be presented with your download history (the filename then the download url). You can then copy and paste that url to wherever you want.

I'm using it for a library of form templates that users can retrieve and I don't want them to corrupt the original template, so am just giving users a link to a folder that just contains the download url shortcuts and keeping the original templates in another folder that I am not making obvious to them.

Hope this helps?

  • This is actually good. Just need to get the download link offered by sharepoint itself. More likely to keep working if you rename the file.
    – r0berts
    Jul 27, 2023 at 16:15

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

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 :


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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