Hi Jonathan,
It is not possible by default to download multiple documents. You can achieve this by zipping the files and than download the zip.
If not already available then create a java action called ‘ZipDocuments’ and add parameters as ‘ZipFileInput’ and ListOfDocuments’ and use below java code in your java action using eclipse.
@java.lang.Override
public java.lang.Boolean executeAction() throws Exception
{
this.ZipFileInput = __ZipFileInput == null ? null : system.proxies.FileDocument.initialize(getContext(), __ZipFileInput);
this.ListOfDocument = new java.util.ArrayList<system.proxies.FileDocument>();
if (__ListOfDocument != null)
for (IMendixObject __ListOfDocumentElement : __ListOfDocument)
this.ListOfDocument.add(system.proxies.FileDocument.initialize(getContext(), __ListOfDocumentElement));
// BEGIN USER CODE
File tempFile = File.createTempFile("zipfile", "tmp");
ZipOutputStream zipfile = new ZipOutputStream(new FileOutputStream(tempFile));
List<String> fileList = new ArrayList<String>();
for (system.proxies.FileDocument file : ListOfDocument) {
String fileName = file.getName();
if (fileList.contains(fileName)) fileName = file.getMendixObject().getId().toLong() + " " + fileName;
fileList.add(fileName);
zipfile.putNextEntry(new ZipEntry(fileName));
InputStream inputStream = Core.getFileDocumentContent(getContext(), file.getMendixObject());
IOUtils.copy(inputStream, zipfile);
zipfile.closeEntry();
}
zipfile.close();
InputStream zipInputStream = new FileInputStream(tempFile);
Core.storeFileDocumentContent(this.getContext(), ZipFileInput.getMendixObject(), zipInputStream);
tempFile.delete();
return true;
// END USER CODE
}
Hope this helps!