---
id: object/codeunit/8950
type: object
title: Codeunit 8950 "AFS File Client"
summary: Codeunit 8950 "AFS File Client" in System Application (System.Azure.Storage.Files). 49 public procedures. Present since at least BC23, still in BC30, changed in BC26.
tier: official
language: en
tags:
  - codeunit
  - system application
versions:
  introduced: null
  last_changed: "26"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: cab58646027b4b03df059bf56759bc5e74c8436af5a09821e9620e37c3d5d6dd
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Azure%20File%20Services%20API/src/AFSFileClient.Codeunit.al
    title: src/System Application/App/Azure File Services API/src/AFSFileClient.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 8950
name: AFS File Client
namespace: System.Azure.Storage.Files
app: System Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "26"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 49
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 2
  called_by: 0
  implements: 0
---

# Codeunit 8950 "AFS File Client"

> Codeunit 8950 "AFS File Client" in System Application (System.Azure.Storage.Files). 49 public procedures. Present since at least BC23, still in BC30, changed in BC26.

System Application · System.Azure.Storage.Files · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Azure%20File%20Services%20API/src/AFSFileClient.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Public |

## Procedures

- `Initialize(StorageAccount: Text; FileShare: Text; Authorization: Interface "Storage Service Authorization")`: Initializes the AFS Client.
- `Initialize(StorageAccount: Text; FileShare: Text; Authorization: Interface "Storage Service Authorization"; APIVersion: Enum "Storage Service API Version")`: Initializes the AFS Client.
- `SetBaseUrl(BaseUrl: Text)`: 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.
- `CreateFile(FilePath: Text; InStream: InStream): Codeunit "AFS Operation Response"`: Creates a file in the file share. This does not fill in the file content, it only initializes the file.
- `CreateFile(FilePath: Text; InStream: InStream; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Creates a file in the file share. This does not fill in the file content, it only initializes the file.
- `CreateFile(FilePath: Text; FileSize: Integer): Codeunit "AFS Operation Response"`: Creates a file in the file share. This does not fill in the file content, it only initializes the file.
- `CreateFile(FilePath: Text; FileSize: Integer; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Creates a file in the file share. This does not fill in the file content, it only initializes the file.
- `GetFileAsFile(FilePath: Text): Codeunit "AFS Operation Response"`: Receives a file as a File from a file share. The file will be downloaded through the browser.
- `GetFileAsFile(FilePath: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Receives a file as a File from a file share. The file will be downloaded through the browser.
- `GetFileAsStream(FilePath: Text; var TargetInStream: InStream): Codeunit "AFS Operation Response"`: Receives a file as a stream from a file share.
- `GetFileAsStream(FilePath: Text; var TargetInStream: InStream; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Receives a file as a stream from a file share.
- `GetFileAsText(FilePath: Text; var TargetText: Text): Codeunit "AFS Operation Response"`: Receives a file as a text from a file share.
- `GetFileAsText(FilePath: Text; var TargetText: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Receives a file as a text from a file share.
- `GetFileMetadata(FilePath: Text; var TargetMetadata: Dictionary of [Text, Text]): Codeunit "AFS Operation Response"`: Receives file metadata as dictionary from a file share.
- `GetFileMetadata(FilePath: Text; var TargetMetadata: Dictionary of [Text, Text]; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Receives file metadata as dictionary from a file share.
- `SetFileMetadata(FilePath: Text; Metadata: Dictionary of [Text, Text]): Codeunit "AFS Operation Response"`: Sets the file metadata.
- `SetFileMetadata(FilePath: Text; var Metadata: Dictionary of [Text, Text]; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Sets the file metadata.
- `PutFileUI(): Codeunit "AFS Operation Response"`: Uploads a file to the file share. User will be prompted to specify the file to send.
- `PutFileUI(AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Uploads a file to the file share. User will be prompted to specify the file to send.
- `PutFileStream(FilePath: Text; var SourceInStream: InStream): Codeunit "AFS Operation Response"`: Uploads a file to the file share from instream.
- `PutFileStream(FilePath: Text; var SourceInStream: InStream; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Uploads a file to the file share from instream.
- `PutFileText(FilePath: Text; SourceText: Text): Codeunit "AFS Operation Response"`: Uploads a file to the file share from text.
- `PutFileText(FilePath: Text; SourceText: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Uploads a file to the file share from text.
- `DeleteFile(FilePath: Text): Codeunit "AFS Operation Response"`: Deletes a file from the file share.
- `DeleteFile(FilePath: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Deletes a file from the file share.
- `ListDirectory(DirectoryPath: Text[2048]; var AFSDirectoryContent: Record "AFS Directory Content"): Codeunit "AFS Operation Response"`: Lists files and directories from the file share.
- `ListDirectory(DirectoryPath: Text[2048]; var AFSDirectoryContent: Record "AFS Directory Content"; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Lists files and directories from the file share.
- `ListDirectory(DirectoryPath: Text[2048]; PreserveDirectoryContent: Boolean; var AFSDirectoryContent: Record "AFS Directory Content"): Codeunit "AFS Operation Response"`: Lists files and directories from the file share.
- `ListDirectory(DirectoryPath: Text[2048]; PreserveDirectoryContent: Boolean; var AFSDirectoryContent: Record "AFS Directory Content"; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Lists files and directories from the file share.
- `CreateDirectory(DirectoryPath: Text): Codeunit "AFS Operation Response"`: Creates directory on the file share.
- `CreateDirectory(DirectoryPath: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Creates directory on the file share.
- `DeleteDirectory(DirectoryPath: Text): Codeunit "AFS Operation Response"`: Deletes an empty directory from the file share.
- `DeleteDirectory(DirectoryPath: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Deletes an empty directory from the file share.
- `CopyFile(SourceFileURI: Text; DestinationFilePath: Text): Codeunit "AFS Operation Response"`: Copies a file on the file share.
- `CopyFile(SourceFileURI: Text; DestinationFilePath: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Copies a file on the file share.
- `AbortCopyFile(DestinationFilePath: Text; CopyID: Text): Codeunit "AFS Operation Response"`: Stops a file copy operation that is in progress.
- `AbortCopyFile(DestinationFilePath: Text; CopyID: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Stops a file copy operation that is in progress.
- `ListHandles(Path: Text; var AFSHandle: Record "AFS Handle"): Codeunit "AFS Operation Response"`: Lists all the open handles to the file.
- `ListHandles(Path: Text; var AFSHandle: Record "AFS Handle"; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Lists all the open handles to the file.
- `RenameFile(SourceFilePath: Text; DestinationFilePath: Text): Codeunit "AFS Operation Response"`: Renames a file on the file share.
- `RenameFile(SourceFilePath: Text; DestinationFilePath: Text; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Renames a file on the file share.
- `AcquireLease(FilePath: Text; ProposedLeaseId: Guid; var LeaseId: Guid): Codeunit "AFS Operation Response"`: Requests a new lease. If the file does not have an active lease, the file service creates a lease on the file.
- `AcquireLease(FilePath: Text; ProposedLeaseId: Guid; AFSOptionalParameters: Codeunit "AFS Optional Parameters"; var LeaseId: Guid): Codeunit "AFS Operation Response"`: Requests a new lease. If the file does not have an active lease, the file service creates a lease on the file.
- `ChangeLease(FilePath: Text; ProposedLeaseId: Guid; var LeaseId: Guid): Codeunit "AFS Operation Response"`: Changes a lease id to a new lease id.
- `ChangeLease(FilePath: Text; ProposedLeaseId: Guid; AFSOptionalParameters: Codeunit "AFS Optional Parameters"; var LeaseId: Guid): Codeunit "AFS Operation Response"`: Changes a lease id to a new lease id.
- `ReleaseLease(FilePath: Text; LeaseId: Guid): Codeunit "AFS Operation Response"`: Releases a lease on a File if it is no longer needed so that another client may immediately acquire a lease against the file.
- `ReleaseLease(FilePath: Text; LeaseId: Guid; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Releases a lease on a File if it is no longer needed so that another client may immediately acquire a lease against the file.
- `BreakLease(FilePath: Text; LeaseId: Guid): Codeunit "AFS Operation Response"`: Breaks a lease on a file.
- `BreakLease(FilePath: Text; LeaseId: Guid; AFSOptionalParameters: Codeunit "AFS Optional Parameters"): Codeunit "AFS Operation Response"`: Breaks a lease on a file.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 8951 "AFS File Client Impl."](../codeunit/8951.md) (23 calls: `AbortCopyFile → AbortCopyFile`, `AcquireLease → FileAcquireLease`, `BreakLease → FileBreakLease`, …)
- [Codeunit 9062 "Storage Service Authorization"](../codeunit/9062.md) (1 call: `Initialize → GetDefaultAPIVersion`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC26

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "AFS File Client")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
