Table of Contents

Codeunit "AFS File Client"

ID 8950
Namespace: System.Azure.Storage.Files

Provides functionality to access the Azure File Storage.

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

Initialize

Initializes the AFS Client.

procedure Initialize(StorageAccount: Text, FileShare: Text, Authorization: Interface "Storage Service Authorization")

Parameters

Name Type Description
StorageAccount Text

The name of the storage account to use.

FileShare Text

The name of the file share to use.

Authorization System.Azure.Storage."Storage Service Authorization"

The authorization to use.

Initialize

Initializes the AFS Client.

procedure Initialize(StorageAccount: Text, FileShare: Text, Authorization: Interface "Storage Service Authorization", APIVersion: Enum "Storage Service API Version")

Parameters

Name Type Description
StorageAccount Text

The name of the storage account to use.

FileShare Text

The name of the file share to use.

Authorization System.Azure.Storage."Storage Service Authorization"

The authorization to use.

APIVersion System.Azure.Storage."Storage Service API Version"

The API Version to use.

SetBaseUrl

The base URL to use when constructing the final URI. If not set, the base URL is https://%1.file.core.windows.net where %1 is the storage account name.

procedure SetBaseUrl(BaseUrl: Text)

Parameters

Name Type Description
BaseUrl Text

A valid URL string

Remarks

Use %1 as a placeholder for the storage account name.

CreateFile

Creates a file in the file share. This does not fill in the file content, it only initializes the file.

procedure CreateFile(FilePath: Text, InStream: InStream): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path where the file will be created.

InStream InStream

The file content, only used to check file size.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object.

CreateFile

Creates a file in the file share. This does not fill in the file content, it only initializes the file.

procedure CreateFile(FilePath: Text, InStream: InStream, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path where the file will be created.

InStream InStream

The file content, only used to check file size.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object.

CreateFile

Creates a file in the file share. This does not fill in the file content, it only initializes the file.

procedure CreateFile(FilePath: Text, FileSize: Integer): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path where the file will be created.

FileSize Integer

The size of the file to initialize, in bytes.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object.

CreateFile

Creates a file in the file share. This does not fill in the file content, it only initializes the file.

procedure CreateFile(FilePath: Text, FileSize: Integer, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path where the file will be created.

FileSize Integer

The size of the file to initialize, in bytes.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object.

GetFileAsFile

Receives a file as a File from a file share. The file will be downloaded through the browser.

procedure GetFileAsFile(FilePath: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileAsFile

Receives a file as a File from a file share. The file will be downloaded through the browser.

procedure GetFileAsFile(FilePath: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileAsStream

Receives a file as a stream from a file share.

procedure GetFileAsStream(FilePath: Text, var TargetInStream: InStream): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

TargetInStream InStream

The result instream containing the content of the file.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileAsStream

Receives a file as a stream from a file share.

procedure GetFileAsStream(FilePath: Text, var TargetInStream: InStream, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

TargetInStream InStream

The result instream containing the content of the file.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileAsText

Receives a file as a text from a file share.

procedure GetFileAsText(FilePath: Text, var TargetText: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

TargetText Text

The result text containing the content of the file.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileAsText

Receives a file as a text from a file share.

procedure GetFileAsText(FilePath: Text, var TargetText: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

TargetText Text

The result text containing the content of the file.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileMetadata

Receives file metadata as dictionary from a file share.

procedure GetFileMetadata(FilePath: Text, var TargetMetadata: Dictionary of [Text, Text]): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

TargetMetadata Dictionary of [Text, Text]

The result dictionary containing the metadata of the file in the form of metadata key and a value.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

GetFileMetadata

Receives file metadata as dictionary from a file share.

procedure GetFileMetadata(FilePath: Text, var TargetMetadata: Dictionary of [Text, Text], AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

TargetMetadata Dictionary of [Text, Text]

The result dictionary containing the metadata of the file in the form of metadata key and a value.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

SetFileMetadata

Sets the file metadata.

procedure SetFileMetadata(FilePath: Text, Metadata: Dictionary of [Text, Text]): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

Metadata Dictionary of [Text, Text]

The dictionary containing the metadata of the file in the form of metadata key and a value.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

SetFileMetadata

Sets the file metadata.

procedure SetFileMetadata(FilePath: Text, var Metadata: Dictionary of [Text, Text], AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

Metadata Dictionary of [Text, Text]

The dictionary containing the metadata of the file in the form of metadata key and a value.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

PutFileUI

Uploads a file to the file share. User will be prompted to specify the file to send.

procedure PutFileUI(): Codeunit "AFS Operation Response"

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

PutFileUI

Uploads a file to the file share. User will be prompted to specify the file to send.

procedure PutFileUI(AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

PutFileStream

Uploads a file to the file share from instream.

procedure PutFileStream(FilePath: Text, var SourceInStream: InStream): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

SourceInStream InStream

The source instream containing the content of the file.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

PutFileStream

Uploads a file to the file share from instream.

procedure PutFileStream(FilePath: Text, var SourceInStream: InStream, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

SourceInStream InStream

The source instream containing the content of the file.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

PutFileText

Uploads a file to the file share from text.

procedure PutFileText(FilePath: Text, SourceText: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

SourceText Text

The source text containing the content of the file.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

PutFileText

Uploads a file to the file share from text.

procedure PutFileText(FilePath: Text, SourceText: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

SourceText Text

The source text containing the content of the file.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

DeleteFile

Deletes a file from the file share.

procedure DeleteFile(FilePath: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

DeleteFile

Deletes a file from the file share.

procedure DeleteFile(FilePath: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

ListDirectory

Lists files and directories from the file share.

procedure ListDirectory(DirectoryPath: Text[2048], var AFSDirectoryContent: Record "AFS Directory Content" temporary): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text[2048]

The path of the directory to list.

AFSDirectoryContent Record "AFS Directory Content" temporary

The result collection with contents of the directory (temporary)

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

ListDirectory

Lists files and directories from the file share.

procedure ListDirectory(DirectoryPath: Text[2048], var AFSDirectoryContent: Record "AFS Directory Content" temporary, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text[2048]

The path of the directory to list.

AFSDirectoryContent Record "AFS Directory Content" temporary

The result collection with contents of the directory (temporary)

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

ListDirectory

Lists files and directories from the file share.

procedure ListDirectory(DirectoryPath: Text[2048], PreserveDirectoryContent: Boolean, var AFSDirectoryContent: Record "AFS Directory Content" temporary): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text[2048]

The path of the directory to list.

PreserveDirectoryContent Boolean

Specifies if the result collection should be cleared before filling it with the response data.

AFSDirectoryContent Record "AFS Directory Content" temporary

The result collection with contents of the directory (temporary)

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

ListDirectory

Lists files and directories from the file share.

procedure ListDirectory(DirectoryPath: Text[2048], PreserveDirectoryContent: Boolean, var AFSDirectoryContent: Record "AFS Directory Content" temporary, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text[2048]

The path of the directory to list.

PreserveDirectoryContent Boolean

Specifies if the result collection should be cleared before filling it with the response data.

AFSDirectoryContent Record "AFS Directory Content" temporary

The result collection with contents of the directory (temporary)

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

CreateDirectory

Creates directory on the file share.

procedure CreateDirectory(DirectoryPath: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text

The path of the directory to create.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

CreateDirectory

Creates directory on the file share.

procedure CreateDirectory(DirectoryPath: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text

The path of the directory to create.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

DeleteDirectory

Deletes an empty directory from the file share.

procedure DeleteDirectory(DirectoryPath: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text

The path of the directory to delete.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

DeleteDirectory

Deletes an empty directory from the file share.

procedure DeleteDirectory(DirectoryPath: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DirectoryPath Text

The path of the directory to delete.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

CopyFile

Copies a file on the file share.

procedure CopyFile(SourceFileURI: Text, DestinationFilePath: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
SourceFileURI Text

The URI to the source file. If the source file is on a different share than the destination file, the URI needs to be authorized.

DestinationFilePath Text

The path where to destination file should be created.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

CopyFile

Copies a file on the file share.

procedure CopyFile(SourceFileURI: Text, DestinationFilePath: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
SourceFileURI Text

The URI to the source file. If the source file is on a different share than the destination file, the URI needs to be authorized.

DestinationFilePath Text

The path where to destination file should be created.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

AbortCopyFile

Stops a file copy operation that is in progress.

procedure AbortCopyFile(DestinationFilePath: Text, CopyID: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DestinationFilePath Text

The path where to destination file should be created.

CopyID Text

The ID of the copy opeartion to abort.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

AbortCopyFile

Stops a file copy operation that is in progress.

procedure AbortCopyFile(DestinationFilePath: Text, CopyID: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
DestinationFilePath Text

The path where to destination file should be created.

CopyID Text

The ID of the copy opeartion to abort.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

ListHandles

Lists all the open handles to the file.

procedure ListHandles(Path: Text, var AFSHandle: Record "AFS Handle" temporary): Codeunit "AFS Operation Response"

Parameters

Name Type Description
Path Text

The path to the file.

AFSHandle Record "AFS Handle" temporary

The result collection containing all the handles to the file (temporary).

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

ListHandles

Lists all the open handles to the file.

procedure ListHandles(Path: Text, var AFSHandle: Record "AFS Handle" temporary, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
Path Text

The path to the file.

AFSHandle Record "AFS Handle" temporary

The result collection containing all the handles to the file (temporary).

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

RenameFile

Renames a file on the file share.

procedure RenameFile(SourceFilePath: Text, DestinationFilePath: Text): Codeunit "AFS Operation Response"

Parameters

Name Type Description
SourceFilePath Text

The path to the source file.

DestinationFilePath Text

The path to which the file will be renamed.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

RenameFile

Renames a file on the file share.

procedure RenameFile(SourceFilePath: Text, DestinationFilePath: Text, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
SourceFilePath Text

The path to the source file.

DestinationFilePath Text

The path to which the file will be renamed.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation response object

AcquireLease

Requests a new lease. If the file does not have an active lease, the file service creates a lease on the file.

procedure AcquireLease(FilePath: Text, ProposedLeaseId: Guid, var LeaseId: Guid): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

ProposedLeaseId Guid

The proposed id for the new lease.

LeaseId Guid

Guid containing the response value from x-ms-lease-id HttpHeader

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation reponse object

AcquireLease

Requests a new lease. If the file does not have an active lease, the file service creates a lease on the file.

procedure AcquireLease(FilePath: Text, ProposedLeaseId: Guid, AFSOptionalParameters: Codeunit "AFS Optional Parameters", var LeaseId: Guid): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

ProposedLeaseId Guid

The proposed id for the new lease.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

LeaseId Guid

Guid containing the response value from x-ms-lease-id HttpHeader

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation reponse object

ChangeLease

Changes a lease id to a new lease id.

procedure ChangeLease(FilePath: Text, ProposedLeaseId: Guid, var LeaseId: Guid): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

ProposedLeaseId Guid

The proposed id for the new lease.

LeaseId Guid

Previous lease id. Will be replaced by a new lease id if the request is successful.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

Return value of type Codeunit "AFS Operation Response".

ChangeLease

Changes a lease id to a new lease id.

procedure ChangeLease(FilePath: Text, ProposedLeaseId: Guid, AFSOptionalParameters: Codeunit "AFS Optional Parameters", var LeaseId: Guid): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

ProposedLeaseId Guid

The proposed id for the new lease.

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

LeaseId Guid

Previous lease id. Will be replaced by a new lease id if the request is successful.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

Return value of type Codeunit "AFS Operation Response".

ReleaseLease

Releases a lease on a File if it is no longer needed so that another client may immediately acquire a lease against the file.

procedure ReleaseLease(FilePath: Text, LeaseId: Guid): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

LeaseId Guid

The Guid for the lease that should be released

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation reponse object

ReleaseLease

Releases a lease on a File if it is no longer needed so that another client may immediately acquire a lease against the file.

procedure ReleaseLease(FilePath: Text, LeaseId: Guid, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

LeaseId Guid

The Guid for the lease that should be released

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation reponse object

BreakLease

Breaks a lease on a file.

procedure BreakLease(FilePath: Text, LeaseId: Guid): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

LeaseId Guid

The Guid for the lease that should be broken

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation reponse object

BreakLease

Breaks a lease on a file.

procedure BreakLease(FilePath: Text, LeaseId: Guid, AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"

Parameters

Name Type Description
FilePath Text

The path to the file.

LeaseId Guid

The Guid for the lease that should be broken

AFSOptionalParameters System.Azure.Storage.Files."AFS Optional Parameters"

Optional parameters to pass with the request.

Returns

Type Description
System.Azure.Storage.Files."AFS Operation Response"

An operation reponse object

See also