Store File from Business Central on Local Static Folder Path without Manual Intervention.
Sagar Mantri
Associate Director - Solution Architect in Microsoft NAV and D365 Business Central, at Mercurius IT | Microsoft Dynamics 365 Solutions for better business | A Safe pair of hands
So, the other day, I was scratching my head to find a way to store the files locally from Business Central without any manual intervention.
Since the launch of Business Central, which is a browser-based application, there has been a limitation to store the files locally without manual intervention to a static folder. Users can save/download them like a any normal browser download file but, it involves additional steps to move that file to desired location.
?After a lot of searches, I came with my own solution to store the file at static location.
Below are the tools I have used
1.????? Azure BLOB Storage
2.????? AZCopy tool by Microsoft
3.????? A BAT file
4.????? And a Windows Task Scheduler
The process/logic will be as below:
1.????? Subscribe for an Azure BLOB storage if not done already and create your own container/folder in it.
2.????? Write a code in AL to move files BC (like report output/XML file/BACS files etc.)
3.????? Now, use AZCopy tool and create a script to copy file from Azure BLOB storage to local folder
4.????? Create a BAT file of this script
5.????? Setup a Windows Task Schedule as per required.
6.????? If required, you can use remove command from AZCopy tool to remove files from Azure BLOB storage.
Sample BAT file:
Note: While creating a BAT file, make sure that you take care of special characters used in script. E.g. if you have % system used in your script (which will be), replace is with %%.
Do give it a try and share your experience.
Reference Links:
1.????? AZCopy: azcopy | Microsoft Learn
2.????? Azure BLOB Storage integration with Business central: Integrating with Azure services - Business Central | Microsoft Learn