File Plugin
The File Plugin of the 365 business Proxy Application enables full access to local file systems, network drives and UNC paths.
It is one of the Standard Plugins and can be installed directly via the Proxy Application Clients page in Microsoft Dynamics 365 Business Central.
AL integration
All functions are provided via the code unit bdev.PRX Proxy Application (ID 5523630).
Example
In the following example, a folder is read in, an existing file is deleted if necessary and a new file with the content “Hello, World!” is created:
Code
Functions at a glance
List files (ListFiles)
Code
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.filePath: Text
Specifies the path or UNC path for which the file list is to be retrieved.fileFilter: Text
Specifies the filter (e.g.*.txt) to be applied to the listing.
Return
Returns the temporary table bdev.PRX File Item, which represents the file list.
Check if file exists (FileExists)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.filePath: Text
Specifies the path or UNC path of the file.
**Returns
Returns true if the file exists.
Read file (GetFile)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.filePath: Text
Specifies the path or UNC path of the file.
Return
Returns Codeunit "Temp Blob" with the content of the file.
Write file (PostFile)
Attention
Please note that the file size limit is 250 MB.
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.filePath: Text
Specifies the path or UNC path of the file.file: Codeunit "Temp Blob"
The file to be written.
**Returns
Returns true if the file was written successfully.
Delete file (DeleteFile)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.filePath: Text
Specifies the path or UNC path of the file.
**Returns
Returns true if the file was successfully deleted.
Move file (MoveFile)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.fromFilePath: Text
Specifies the path or UNC path of the file to be moved.toFilePath: Text
Specifies the target path or UNC path to which the file is to be moved.overwrite: Boolean
Specifies whether the file should be overwritten at the destination if it already exists.
**Returns
Returns true if the file was successfully moved.
Copy file (CopyFile)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.fromFilePath: Text
Specifies the path or UNC path of the file to be copied.toFilePath: Text
Specifies the target path or UNC path to which the file is to be copied.overwrite: Boolean
Specifies whether the file should be overwritten at the destination if it already exists.
**Returns
Returns true if the file was copied successfully.
Rename file (RenameFile)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.filePath: Text
Specifies the path or UNC path of the file.newFilePath: Text
Specifies the new name and path of the file.
**Returns
Returns true if the file has been successfully renamed.
Check if directory exists (DirectoryExists)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.directoryPath: Text
Specifies the path or UNC path of the directory.
**Returns
Returns true if the directory exists.
Create directory (CreateDirectory)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.directoryPath: Text
Specifies the path or UNC path of the directory to be created.
**Returns
Returns true if the directory has been created.
Delete directory (DeleteDirectory)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.directoryPath: Text
Specifies the path or UNC path of the directory to be deleted.recursive: Boolean
Specifies whether the directory is to be deleted recursively.
**Returns
Returns true if the directory has been deleted.
Move directory (MoveDirectory)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.fromDirectoryPath: Text
Specifies the path or UNC path of the directory to be moved.toDirectoryPath: Text
Specifies the path or UNC path to which the directory is to be moved.
**Returns
Returns true if the directory has been moved.
Copy directory (CopyDirectory)
Code
Parameter
clientId: Guid(Optional)
Specifies the ID of the proxy application client on which the operation is to be executed.fromDirectoryPath: Text
Specifies the path or UNC path of the directory to be copied.toDirectoryPath: Text
Specifies the path or UNC path to which the directory is to be copied.
**Returns
Returns true if the directory has been copied.


