SharePoint 2013 "Download a copy" button/link for document library -


i have document library in sp2013 full of forms. users confused "check out required" box pops when open file. keep telling them need download copy, seems issue. so, looked adding "download copy" button or link library, , came solution, put in snippet on web part page (source: https://amalhashim.wordpress.com/2013/11/29/sharepoint-2013-document-library-download-a-copy-button/):

<script type="text/javascript"> function runaftereverythingelse(){ var elementarray = document.getelementsbyclassname("ms-vb-lastcell"); var idarray = document.getelementsbyclassname("ms-listlink"); for(var = 0; < elementarray.length; i++) { elementarray[i].innerhtml = '<a unselectable="on" href="javascript:;" onclick="window.open(\''+ idarray[i]['href'] + '\')" class="ms-cui-ctl-large " aria-describedby="ribbon.documents.copies.download_tooltip" mscui:controltype="button" role="button" id="ribbon.documents.copies.download-large"><span unselectable="on" class="ms-cui-ctl-largeiconcontainer"><span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float"><img unselectable="on" alt="" src="/_layouts/15/1033/images/formatmap32x32.png?rev=31" style="top: -409px; left: -35px;"></span></span><span unselectable="on" class="ms-cui-ctl-largelabel">download a<br>copy</span></a>'; }   } _spbodyonloadfunctionnames.push("runaftereverythingelse");   

this partially works, in puts button next each document says "download copy," action open file in word (instead of in browser). check-out prompt still there, know it's opening file , not downloading copy. while way looks, functionality isn't right.

in answers question here (how trigger file download when clicking html button or javascript), found instructions, can't figure out how use them. tried creating workflow created download link , put in html-formatted field, can't formatting right.

i don't care if solution library-based (a field on each document created through nintex workflow) or web part page based (script/snippet). i'm not fluent jquery, javascript, or other programming languages. know html, , can fumble way through css, i'm pretty straight copy-paste internet solution kind of girl. not programmer, person manages our sharepoint site alongside may other job functions. :)

any advice on how tweak original code or how better appreciated. we're using sp2013.

@kelly implemented solution in sharepoint 2010 using dataview webpart.

dataview webparts loops through documents in doc library , below code allow user download file.

<a href="https://<siteurl>/_layouts/download.aspx?sourceurl=https://<siteurl>/doclibrary/test.docx">test.docx - download copy</a> 

i hope helps. :)


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -