I want to download multiple documents from document library. I select several documents and then click on 'download' icon present in ribbon. It should download all files and retain its metadata. 'Download' should be custom action in ribbon. Can anyone please provide me custom code for the same.


That's more a case of LMGTFY - Here's a complete tutorial plus a .wsp to add this function.

To get some basic understanding

Since you can't download multiple files in one response, you need to package them in a .zip for example. What you have to do is getting the byte[] foreach file and package them together. Then add created .zip to the response to invoke a download dialog.

| improve this answer | |
  • I also got another link while googling adicodes.com/download-files-as-zip-file-in-sharepoint This blog is reference of same blog you provided, but in this blog he changed a code little bit. can you please help where exactly code need to be changed wrt your link – Brishal Jul 2 '14 at 12:07
  • There is a problem when you are not at root level. The comments in the blog I referred are giving a lot of extra information. Example - deviantpoint.com/post/2010/05/08/… – Mx. Jul 2 '14 at 12:12
  • yes, so where exactly we need to make code change if I have to do same in subsite? code is provided in link provided by me.. but i cannot judge where exactly change need to be made(in which file) – Brishal Jul 2 '14 at 12:50
  • as written in the comment I linked in my previous comment "I changed Ln36 in CustomAction.js to form.setAttribute("action", this.site.get_url() + "/_layouts/deviantpoint.downloadzip/downloadzip.aspx"); and Ln16 in DownloadZip.aspx.cs to string docLibUrl = fullDocLibSourceUrl;" -- See more at: deviantpoint.com/post/2010/05/08/… – Mx. Jul 2 '14 at 12:51
  • if you want it to work for document library webparts you have to make the changes described in this comment - deviantpoint.com/post/2010/05/08/… – Mx. Jul 2 '14 at 12:53

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.