I always loved the feature of "Download all attachments" in Gmail. So I decided we should have this option available in XPages also. To use "Download all attachments" you need only one XPage: xDownloadAllAttachments. It basically uses Java ZIP API (java.util.zip package) to Zip the attachments.

You can also download the entire XPage source from XSnippets.

Just call the XPage xDownloadAllAttachments by passing the document UNID in query string to it.

For e.g.

http://SERVER_NAME/DATABASE_PATH/xDownloadAllAttachments.xsp?documentUNID=DOCUMENT_UNID&zipFileName=NAME_OF_ZIP_FILE

That's it, you are done!

Parameters to query string

1. documentUNID – Universal ID of the document in which attachments are present. This is a mandatory parameter.

2. zipFileName – Name of zip file when the download box is shown to the user. This is optional and if this parameter is not specified then by default AllAttachments.zip name is taken.