Pages

Wednesday, January 8, 2020

Download Multiple Files from Libraries

Consider a scenario in which we are suppose to download all files from libraries. Below are different approach which can be utilized:

Approach 1: Salesforce UI Download Button

If the file size is around 60 or less in library then you can use Salesforce UI to download all files at one time.

Open any library, click on show all button, then click on display options and select "Show 60 results per page". By doing this, you will be able to see 60 files at once in library. Now you can click on select all checkbox and click download button. This will help you to download files at once.
If you have more than 60 files, then click on next page and then again download all files. This process will become hectic if you have more than 1000 files in library.

Approch 2:URL hack

I performed some search on google and found out that there is another way to download all files as zip by specifying the contentversion Ids of file in URL. I can call it as URL hack and everyone mentioned that it is not recommended way. Below is URL format that you need to use:

https://xxxxxx.salesforce.com/sfc/servlet.shepherd/version/download/068xxxxxxxxxxxxxxx/068yyyyyyyyyyyyyyy/068wwwwwwwwwwwwwww/068zzzzzzzzzzzzz?

Just paste this URL and files will be downloaded as zip file.

If you have more than 1000 files in library, then you have to build different URL by specifying 10 or 15 record id in one URL. I was able to download zip file with size around 400Mb using one URL.

Approach 3: Using Apex Script & Tab Save Chrome Extension

One of my friend told me about Tab Save  chrome extension. You just need to paste all files download url and click on download.



This will download all files in your downloads folder or folder that you have specified in chrome download settings.

Now we wrote simple apex script which will send email with all URLs(file download URL) in csv file. Suppose you want to get download URLs for all files present in library "Demo Download Library", then refer below script:

Run above script in developer console by specifying your library name. You will receive email with all file download URLs. Now you just copy and paste these URLs in Tab Save edit window and click on download.

I have used Tab Save extension to download around 1500 files and it was working fine.

Now you have all 3 approaches and you can decide what to chose based on your requirements.

Hope this will help!!



11 comments:

  1. Thank you very much for this helpful article. Downloading files one by one from libraries was really monotonous and boring task.

    ReplyDelete
  2. https://www.youtube.com/embed/t5eVFM7NBfs

    ReplyDelete
  3. Nice Artical! But How to send dynamic downloaded file name ?

    ReplyDelete
  4. This is awesome! Thanks so much for sharing!

    ReplyDelete
  5. You can use SFDC File Exporter to extract Salesforce Files, Documents & Attachments in its original format
    https://www.sfdcfileexporter.com/

    ReplyDelete
  6. good info, and just makes you shake your head that libraries are so poorly implemented that such a basic feature is not available.

    ReplyDelete
  7. Wow awesome article. Really looking forward to read more. Fantastic.
    share files

    ReplyDelete
  8. Downloading Files/Attachments in mass is really a day to day requirement in Salesforce. Many of the projects I have come across have this requirement one or another way. So, after exploring a bit on Salesforce AppExchange, I found an awesome solution that meets such a requirement - Mass File Download (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000EcsAOUAZ) - All native within the Salesforce environment, plug & play, it just works great!!!!!
    I would recommend this - Mass File Download tool on AppExchange, it's really helpful and easy to use.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Try FileZIPO app to perform this tedious task within few clicks.

    ReplyDelete