loading
0%

Hello-Site.ru. Бесплатный конструктор сайтов.

Stand with Ukraine! Support here

​Redesign of work with files to make a Business Central extension cloud-ready

Sep 27, 2024 dynamics nav MSDyn365BC D365BC
177

Andrii Severin, Lead Software Development Engineer of Xpand:

Introduction

Starting from Microsoft Dynamics 365 Business Central 2022 release wave 2, Microsoft introduced the Business Central Universal Code initiative. This initiative was aimed at encouraging partners to use modern architecture for customer implementations in Business Central. The initiative reduces complex and expensive upgrades for new versions of Business Central and frees up time for implementing/reimplementing the customizations to provide more value for the customers.

When Microsoft introduced the Universal Code Initiative, making the Business Central extensions cloud-ready became a necessity. The initiative required all code to be implemented only in extensions and optimized for the cloud. The first task is solved by performing the event refactoring of the customization, and the second by rewriting or redesigning the unsupported functionalities.

In most cases, optimizing code for the cloud requires us to redesign the following functionalities:

  • WorkIng with file system
  • Usage of DotNet variables
  • Usage of On-Prem procedures

Let’s dive into the most common functionality that needs redesigning: working with the file system.

In case the solution uses only temporary files it can be easily handled by data processing in memory using the methods that work with streams in the standard Business Central. However, in case the solution requires reading and writing files from a shared folder and/or silently (without interaction with a user), it can be a little bit harder to choose the way to proceed. An example of the functionality that requires such work with files is EDI (Electronic Data Interchange). Such functionality allows us to exchange business documents in a standard electronic format between business partners.

How can working with non-temporary files be redesigned? The most popular services that assist with this are:

In the early versions of Business Central, there were no standard modules to help us redesign the work with files. However, it was possible to implement solutions using the web service calls to REST API of one of the mentioned services.

Currently, the System extension of the standard Business Central provides the possibility to work with such services without the necessity to implement the web service communication ourselves.
Let’s look at these services more deeply and understand how they can be used.

Azure Blob Storage

Azure Blob Storage is a cloud-based object storage solution from Microsoft optimized for storing massive amounts of unstructured data (such as text or binary data). In most cases, this service is used to store images, documents, video, audio, log files, and backups. Files can be grouped into containers (for example, by creating different containers for various types), but it is not possible to create a file hierarchy all files will be on the same level within the container.

This service provides REST API. However, starting from Business Central 2021 release wave 2, the Azure Blob Storage API module is included in standard Business Central. This module provides AL functionality to simplify the usage of Azure Blob Storage. It allows to create, delete, and list containers, upload and download BLOBs, and manipulate data stored in Azure Blob Storage.

Azure Files


Azure Files is a cloud-based Microsoft service that provides file shares accessible via the industry standard Server Message Block (SMB) protocol and Network File System (NFS) protocol, and Azure Files REST API. The way of storing files is quite similar to the file system (this service supports a hierarchy of folders, and the file share can be mounted as a local disk).

This service provides REST API. However, starting with update 23.3 for Business Central 2023 release wave 2, the standard Business Central provides the Azure File Services API module. This module can be used to work with Azure Files. In combination with the Azure Storage Services Authorization module, which provides methods for working with the authentication, the integration with the Azure Files becomes easier. Using these standard modules, it is possible to perform basic file operations such as creating, deleting, uploading, downloading, copying, and renaming files, as well as directory operations like listing, creating, deleting, and renaming folders.

SharePoint

SharePoint is a collaboration and content management platform that allows us to manage (store, organize, share, access) content, data, and applications. This software provides many functionalities; however, in this article, we will focus on the functionality for working with files. This software can be deployed on the on-premises server or as a cloud service.

This service can be accessible via the SharePoint REST APIs or Microsoft Graph. However, starting with update 21.1 for Business Central 2022 release wave 2, the following modules for the SharePoint integration are present in the standard Business Central: SharePoint and SharePoint Authorization. These modules enable connecting, authenticating, and performing basic operations with files, folders, lists, and list attachments through the SharePoint REST APIs.


Looking for more insights from our experts related to the Microsoft Dynamics 365 Business Central topic? Check out our latest articles: Power of AI in Microsoft Dynamics 365 Business Central: Today’s Innovations, Tomorrow’s Possibilities or 10 Don’ts when designing customizations in Microsoft Dynamics 365 Business Central.


Comparative analysis

Let’s compare the mentioned services by the following criteria that can be important for the users:

  • Availability of on-premises service installation

  • Ability to map a directory to a local disk
  • Ability to create a hierarchy of files
  • Existence of a standard BC module(s) for working with the service
  • Access to a file via URL
  • Ability to open a file in a browser
  • Access to a directory via URL
  • Ability to open a directory a browser
  • Easy-to-use integration with other Azure services (Microsoft Power Automate, Azure Logic Apps, Power Apps, etc.)
  • Co-editing

  • Pricing

When discussing the availability of on-premises service installation, it's important to note that Azure services are cloud-based and cannot be installed on-premises. In contrast, SharePoint provides both installation options: cloud and on-premises.

One of the important features of these services is the ability to map a directory to a local disk which helps users to work with files more easily. Azure Blob Storage service doesn’t provide such functionality for Windows computers. Azure Files service, however, offers an easy-to-use functionality that maps the file share to a local drive. Meanwhile, SharePoint allows us to work with files via File Explorer using the Add shortcut to My Files or Sync functionality which makes a similar action.

Another important feature is the ability to create a file hierarchy, allowing users to group files into folders based on their needs (by functionality, customer, user, etc.). Azure Files and SharePoint provide such an ability, whereas Azure Blob Storage saves all files at the same level (container level). 

As mentioned above, Microsoft Dynamics 365 Business Central provides the standard modules for integration with such services, which simplifies their usage.

Other useful features are access to a file via URL and the ability to open files in a browser directly from Business Central. All the considered services provide access to a file via URL, however, since they use different approaches to store the data, there is a different behavior when the URL is used in a browser. For example:

  • When we try to open the URL to a file stored in Azure Blob Storage, it will be downloaded (however, it is possible to edit/view/download files from the Azure portal).
  • When we try to open the URL to a file stored in Azure Files, an error will be shown since this service is an SMB protocol implementation that can't be accessed over the HTTP protocol (however, it is possible to edit/view/download file from the Azure portal and/or File Explorer).
  • When we use SharePoint, it is possible to open a file in a browser and edit it.

Another key consideration is directory access via URL and the ability to open a directory in a browser from Business Central. Azure Blob Storage doesn't support file hierarchies, so these features are irrelevant to this service. Azure Files provides access to a directory via URL. This directory can be opened via File Explorer; however, it is impossible to open a directory directly in a browser. SharePoint provides both features: access to a directory via URL and the ability to open a directory in a browser.

Sometimes it is necessary to perform some extra actions with files. For example, to upload/download files from/to the SFTP server or to send a notification when a file is uploaded. Such functionalities can be easily implemented by integrating a file storage service with other Azure services (such as Microsoft Power Automate, Azure Logic Apps, Power Apps, etc.). All considered services support easy-to-use integration with such services and between each other, since all of them are in the Microsoft ecosystem.

The co-editing feature is also present in SharePoint compared with other services. However, in most cases, this does not matter for the files processed by Business Central.

Finally, pricing is an significant consideration. SharePoint software provides a lot of functionality compared with others; therefore, the price is the highest (if there is a SharePoint license, 1 TB per user is included in it, and then it is necessary to buy extra space). Azure Blob Storage service provides fewer features compared with others; therefore, this service is the cheapest. Azure Files service provides an average number of features, therefore, the price is medium.

Conclusion

To sum up, the most popular services for replacing traditional file system functionality in Business Central extensions and making them cloud-ready are Azure Blob Storage, Azure Files, and SharePoint. Currently, standard Business Central contains modules that simplify the integration of Business Central with each of these services.

Therefore, when redesigning, the main task is to choose a proper solution based on the user scenarios to suit the customer’s needs in the best way. When it is necessary just to upload/download files without maintaining hierarchy, then Azure Blob Storage is the best choice. In case it is necessary to have a similar functionality as in a file system (for example, move a file from the To Process folder to the Processed one after processing) and there is no necessity to co-edit files and/or open folders directly for the Business Central, Azure Files service is the ideal option. When it is necessary to have rich functionality and the required storage capacity is low (or the price for extra space is not critical), it would be better to use SharePoint.


Do you happen to have any knowledge about Xpand?

Xpand is a product and service software development company with over 14 years of market experience and a Microsoft Partner since 2016, assisting organizations worldwide in managing their Microsoft Dynamics ERP and CRM systems. We provide a broad range of services for clients and partners, including implementation and development for Microsoft Dynamics 365 Business Central, as well as upgrades from earlier versions like Navision Financials 2.0. Learn more about our services at https://www.xpandsoftware.com/services.

Curious about the key highlights of Microsoft Dynamics 365 Business Central 2024 Release Wave 1? Our Xpand experts have picked out the most important updates. Read the full article here.


177