Solved

Download all documents from a ListView that has a SharePoint Content smart object as a data source.

  • 10 December 2015
  • 6 replies
  • 90 views

Badge +2

Hi All,

 

I am stuck at the moment with a requirement at a client. They are using the SharePoint content service to access document libraries to store and retrieve documents.

This current requirement is to retrieve a list of documents, display it in a listview and then to have a button on the listview that will download all the documents displayed.

 

I have yet to find a way to do this as the SmartObject doesnt  allow you to specifically download files as a batch.

 

Can anyone please shed some light on this ?

 

Kind regards,

 

Helgard Wagener

icon

Best answer by ajo 11 December 2015, 05:36

View original

6 replies

Badge +9

Helgard


 


Out of the box, there is no method for downloading multiple files at the same time from a SmartForm. If you are looking to implement this functionality, you will likely have to implement a custom control. It would likely have to iterate through the documents on the list and add them to a single download. This will more than likely cause a significant hit to performance, as it would require having the control download all the documents in the users place so that the user can download them all at once.


 


Ian

Badge +12

Hello,

I have played around with the for loops in 4.6.10 and found a way to download the files in a list view with a button click. I have the assumption that everything displayed on the list view has been filtered as per your requirements. Also, I have only tested this on Chrome and Firefox. 

1. I have a list view which displays the files I would need to download. I used the OOB smartobject to store the files

2. I added three additional controls aside from the list:
- Data Label: where we will inject the script
- File attachment control: where the files on the list view will be loaded one at a time
- Button: on click will download all files listed

3.  When the button is clicked, add the condition: For each item in a List View. Configure it for ALL rows

4. Then on the smartobject tied to the list, add the action to execute the Load method


<script>
$('label[for="00000000-0000-0000-0000-000000000000_6d56b5e1-a015-79aa-90f1-a9f43d7416fc_file-inputId"]').click()
</script>

The label ID is from here:


Hope this helps.

 

Badge +7
Hi,

Just to keep performance in mind while using for each loop, please make sure you have got maximum up to 5 document records, if you trying to achieve this requirement in some of the admin forms where you need to download 20 plus documents on single shot it gets your form stuck in not responding state and very poor performance. In such scenarios I would definitely write code gives to assembly and refer it using endpoint assembly broker to build your SmartObject and call it on the form.
Badge +2

Hi Ajo,

 

This is exactly what I was looking for, I got it working on the second time around. Thank you very much, a well deserved Kudos.

 

Kind regards,

 

Helgard Wagener

Badge +8

Worked nicely for me too.

Badge +8

Just ran into a snag.. This works great with Chrome, but Internet Explorer will only download one file. Any one else have issues with Internet Explorer?

Reply