In this blog, we will explore how to download multiple files simultaneously in Microsoft Dynamics 365 Business Central.
By default, the DownloadFromStream function allows us to download a single file. However, when attempting to use it for multiple files, only the last file will be downloaded. To address this issue, we need to package the files into a ZIP folder and download the ZIP instead.
The DownloadFromStream function handles single file downloads. When processing multiple files without bundling, it overwrites previous files, leaving only the last one. By creating a ZIP folder, we can include all files and download them as a single package.
AL Code Example
Below is an example of how to download multiple files in a ZIP folder:
1. I have created Action named “Download Customer Data” on customer list page to download ZIP file which will store each customer details in separate file:
2. By calling the Action, Zip Folder containing multiple files will be download as below:
3. See below screenshot of few files which are having different details in each file:
By following this approach, you can easily download multiple files in Business Central as a single ZIP folder. This ensures that all files are included and avoids the limitation of the DownloadFromStream function handling only one file at a time.
Thanks for reading!!
If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way.
Let’s turn your vision into reality together!