Summary

Completed

In this module, you learned that you can use the file data type to import and export files in Business Central. However, because you can't access the file system directly, you need to use the streaming functions of the file data type.

You can use the UploadIntoStream function to upload a file to Business Central. This function will prompt the user to select a file from their local disk and upload that file. The DownloadFromStream function is used to export a file to the user. It will give the user a download prompt and enables the user to save the file locally.

Working with streams involves working with the InStream and OutStream data types. The Temp Blob codeunit can help you convert streams. The File Management codeunit provides useful functions if you want to handle file names and file extensions.

If you work with text files, you need to be aware of the different encoding formats. Business Central supports MS-DOS, UTF-8, UTF-16, and ANSI encoding.