locked
Downloading files from hyperlink RRS feed

  • Question

  • I have kept files in site assets and created hyperlinks to the files (which may be PDF or word ). When i click on the link it opens up in the browser. How do i force it to download ?

    Wednesday, August 31, 2016 7:04 AM

Answers

All replies

  • Hi Roma,

    To force a file for download, use the below URL format for hyperlink:

    https://sharepointsite.com/_layouts/15/download.aspx?SourceUrl=https://sharepointsite.com/SiteAssets/file.doc


    Regards, Sathiya

    • Proposed as answer by romeo donca Wednesday, August 31, 2016 5:17 PM
    • Marked as answer by roma_victa Sunday, September 4, 2016 4:38 AM
    Wednesday, August 31, 2016 5:04 PM
  • Hi

    I agree with Sathiya Kamalanathan with 2 remarks

    - use relative path in your code to avoid domain URL changes :

    - to give users an option to view the doc also in browser as well, keep the standard hlink, and add next to the link a little icon which will permit to download the file using the code as Sathiya Kamalanathan said


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Wednesday, August 31, 2016 5:20 PM
  • Hi thanks for the replay guys.

    I have done the below but couldn't get it to work it will go to the current page. please see the url i have used.

    https://keoic.sharepoint.com/sites/General/Community%20Portal/PMCM/SitePages/Introduction.aspx?SourceUrl=https//keoic.sharepoint.com/sites/General/Community%20Portal/SiteAssets/PDF/1.pdf

    • Edited by roma_victa Thursday, September 1, 2016 9:43 AM
    Thursday, September 1, 2016 9:40 AM
  • Hi

    I tried and it is working

    Use download.aspx? instead of Introduction.aspx

    https://DOMAIN/SITE_PATH/_layouts/15/download.aspx?SourceUrl=https://DOMAIN/SITE_PATH/LIBRARY/FILE.EXT


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Thursday, September 1, 2016 9:52 AM
  • hi Romeo,

    i have deactivated Minimal Download Strategy feature hence my url do not have /_layout/15. i tried the below

    and was not working 

    https://he.sharepoint.com/sites/General/Community%20Portal/PMCM/SitePages/Introduction.aspx /_layouts/15/download.aspx?SourceUrl=https://he.sharepoint.com/sites/General/Community%20Portal/SiteAssets/PDF/1.pdf

    any ideas


    • Edited by roma_victa Thursday, September 1, 2016 10:29 AM
    Thursday, September 1, 2016 10:23 AM
  • I enabled in the site level but its still the same

    Thursday, September 1, 2016 10:29 AM
  • Thursday, September 1, 2016 2:29 PM
  • Thanks guys i used the url of the current site not the url of the document to be downloaded as the first part of the url.

    I have changed it and now it work. 

    Thanks for your help.

    Sunday, September 4, 2016 5:51 AM