Table of Contents

Class ShareDirectoryClient

Namespace
Azure.Storage.Files.Shares
Assembly
Azure.Storage.Files.Shares.dll

A DirectoryClient represents a URI to the Azure Storage File service allowing you to manipulate a directory.

public class ShareDirectoryClient
Inheritance
ShareDirectoryClient
Inherited Members
Extension Methods

Constructors

ShareDirectoryClient()

Initializes a new instance of the ShareDirectoryClient class for mocking.

protected ShareDirectoryClient()

ShareDirectoryClient(string, string, string)

Initializes a new instance of the ShareDirectoryClient class.

public ShareDirectoryClient(string connectionString, string shareName, string directoryPath)

Parameters

connectionString string

A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.

For more information, Configure Azure Storage connection strings

shareName string

The name of the share in the storage account to reference.

directoryPath string

The path of the directory in the storage account to reference.

ShareDirectoryClient(string, string, string, ShareClientOptions)

Initializes a new instance of the ShareDirectoryClient class.

public ShareDirectoryClient(string connectionString, string shareName, string directoryPath, ShareClientOptions options)

Parameters

connectionString string

A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.

For more information, Configure Azure Storage connection strings

shareName string

The name of the share in the storage account to reference.

directoryPath string

The path of the directory in the storage account to reference.

options ShareClientOptions

Optional ShareClientOptions that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

ShareDirectoryClient(Uri, AzureSasCredential, ShareClientOptions)

Initializes a new instance of the ShareDirectoryClient class.

public ShareDirectoryClient(Uri directoryUri, AzureSasCredential credential, ShareClientOptions options = null)

Parameters

directoryUri Uri

A Uri referencing the directory that includes the name of the account, the name of the share, and the path of the directory. Must not contain shared access signature, which should be passed in the second parameter.

credential AzureSasCredential

The shared access signature credential used to sign requests.

options ShareClientOptions

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

Remarks

This constructor should only be used when shared access signature needs to be updated during lifespan of this client.

ShareDirectoryClient(Uri, TokenCredential, ShareClientOptions)

Initializes a new instance of the ShareDirectoryClient class.

Note that ShareTokenIntent is currently required for token authentication.

public ShareDirectoryClient(Uri directoryUri, TokenCredential credential, ShareClientOptions options = null)

Parameters

directoryUri Uri

A Uri referencing the directory that includes the name of the account, the name of the share, and the path of the directory.

credential TokenCredential

The token credential used to sign requests.

options ShareClientOptions

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

ShareDirectoryClient(Uri, ShareClientOptions)

Initializes a new instance of the ShareDirectoryClient class.

public ShareDirectoryClient(Uri directoryUri, ShareClientOptions options = null)

Parameters

directoryUri Uri

A Uri referencing the directory that includes the name of the account, the name of the share, and the path of the directory.

options ShareClientOptions

Optional ShareClientOptions that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

ShareDirectoryClient(Uri, StorageSharedKeyCredential, ShareClientOptions)

Initializes a new instance of the ShareDirectoryClient class.

public ShareDirectoryClient(Uri directoryUri, StorageSharedKeyCredential credential, ShareClientOptions options = null)

Parameters

directoryUri Uri

A Uri referencing the directory that includes the name of the account, the name of the share, and the path of the directory.

credential StorageSharedKeyCredential

The shared key credential used to sign requests.

options ShareClientOptions

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

Properties

AccountName

Gets the Storage account name corresponding to the directory client.

public virtual string AccountName { get; }

Property Value

string

CanGenerateSasUri

Indicates whether the client is able to generate a SAS uri. Client can generate a SAS url if it is authenticated with a Azure.Storage.StorageSharedKeyCredential.

public virtual bool CanGenerateSasUri { get; }

Property Value

bool

Name

Gets the name of the directory.

public virtual string Name { get; }

Property Value

string

Path

Gets the path of the directory.

public virtual string Path { get; }

Property Value

string

ShareName

Gets the share name corresponding to the directory client.

public virtual string ShareName { get; }

Property Value

string

Uri

Gets the directory's primary Uri endpoint.

public virtual Uri Uri { get; }

Property Value

Uri

Methods

Create(IDictionary<string, string>, FileSmbProperties, string, CancellationToken)

The Create(IDictionary<string, string>, FileSmbProperties, string, CancellationToken) operation creates a new directory at the specified Uri.

For more information, see Create Directory.

public virtual Response<ShareDirectoryInfo> Create(IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

metadata IDictionary<string, string>

Optional custom metadata to set for this directory.

smbProperties FileSmbProperties

Optional SMB properties to set for the directory.

filePermission string

Optional file permission to set on the directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryInfo>

A Azure.Response<> describing the newly created directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

CreateAsync(IDictionary<string, string>, FileSmbProperties, string, CancellationToken)

The CreateAsync(IDictionary<string, string>, FileSmbProperties, string, CancellationToken) operation creates a new directory at the specified Uri.

For more information, see Create Directory.

public virtual Task<Response<ShareDirectoryInfo>> CreateAsync(IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

metadata IDictionary<string, string>

Optional custom metadata to set for this directory.

smbProperties FileSmbProperties

Optional SMB properties to set for the directory.

filePermission string

Optional file permission to set on the directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryInfo>>

A Azure.Response<> describing the newly created directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

CreateFile(string, long, ShareFileHttpHeaders, IDictionary<string, string>, FileSmbProperties, string, ShareFileRequestConditions, CancellationToken)

Creates a new file or replaces an existing file.

For more information, see Create File.

public virtual Response<ShareFileClient> CreateFile(string fileName, long maxSize, ShareFileHttpHeaders httpHeaders = null, IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, ShareFileRequestConditions conditions = null, CancellationToken cancellationToken = default)

Parameters

fileName string

The name of the file.

maxSize long

Required. Specifies the maximum size for the file in bytes. The max supported file size is 4 TiB.

httpHeaders ShareFileHttpHeaders

Optional standard HTTP header properties that can be set for the file.

metadata IDictionary<string, string>

Optional custom metadata to set for the file.

smbProperties FileSmbProperties

Optional SMB properties to set for the file.

filePermission string

Optional file permission to set for the file.

conditions ShareFileRequestConditions

Optional ShareFileRequestConditions to add conditions on creating the file.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareFileClient>

A Azure.Response<> referencing the file.

Remarks

This method only initializes the file. To add content, use Azure.Storage.Files.Shares.ShareFileClient.UploadRange(Azure.HttpRange,System.IO.Stream,System.Byte[],System.IProgress{System.Int64},Azure.Storage.Files.Shares.Models.ShareFileRequestConditions,System.Threading.CancellationToken).

CreateFileAsync(string, long, ShareFileHttpHeaders, IDictionary<string, string>, FileSmbProperties, string, ShareFileRequestConditions, CancellationToken)

Creates a new file or replaces an existing file.

For more information, see Create File.

public virtual Task<Response<ShareFileClient>> CreateFileAsync(string fileName, long maxSize, ShareFileHttpHeaders httpHeaders = null, IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, ShareFileRequestConditions conditions = null, CancellationToken cancellationToken = default)

Parameters

fileName string

The name of the file.

maxSize long

Required. Specifies the maximum size for the file in bytes. The max supported file size is 4 TiB.

httpHeaders ShareFileHttpHeaders

Optional standard HTTP header properties that can be set for the file.

metadata IDictionary<string, string>

Optional custom metadata to set for the file.

smbProperties FileSmbProperties

Optional SMB properties to set for the file.

filePermission string

Optional file permission to set for the file.

conditions ShareFileRequestConditions

Optional ShareFileRequestConditions to add conditions on creating the file.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareFileClient>>

A Azure.Response<> referencing the file.

Remarks

This method only initializes the file. To add content, use Azure.Storage.Files.Shares.ShareFileClient.UploadRangeAsync(Azure.HttpRange,System.IO.Stream,System.Byte[],System.IProgress{System.Int64},Azure.Storage.Files.Shares.Models.ShareFileRequestConditions,System.Threading.CancellationToken).

CreateIfNotExists(IDictionary<string, string>, FileSmbProperties, string, CancellationToken)

The CreateIfNotExists(IDictionary<string, string>, FileSmbProperties, string, CancellationToken) operation creates a new directory, if it does not already exists. If the directory already exists, it is not modified.

For more information, see Create Directory.

public virtual Response<ShareDirectoryInfo> CreateIfNotExists(IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

metadata IDictionary<string, string>

Optional custom metadata to set for this directory.

smbProperties FileSmbProperties

Optional SMB properties to set for the directory.

filePermission string

Optional file permission to set on the directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryInfo>

A Azure.Response<> describing the newly created directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

CreateIfNotExistsAsync(IDictionary<string, string>, FileSmbProperties, string, CancellationToken)

The CreateIfNotExistsAsync(IDictionary<string, string>, FileSmbProperties, string, CancellationToken) operation creates a new directory, if it does not already exists. If the directory already exists, it is not modified.

For more information, see Create Directory.

public virtual Task<Response<ShareDirectoryInfo>> CreateIfNotExistsAsync(IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

metadata IDictionary<string, string>

Optional custom metadata to set for this directory.

smbProperties FileSmbProperties

Optional SMB properties to set for the directory.

filePermission string

Optional file permission to set on the directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryInfo>>

A Azure.Response<> describing the newly created directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

CreateSubdirectory(string, IDictionary<string, string>, FileSmbProperties, string, CancellationToken)

The CreateSubdirectory(string, IDictionary<string, string>, FileSmbProperties, string, CancellationToken) operation creates a new subdirectory under this directory.

For more information, see Create Directory.

public virtual Response<ShareDirectoryClient> CreateSubdirectory(string subdirectoryName, IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

subdirectoryName string

The name of the subdirectory.

metadata IDictionary<string, string>

Optional custom metadata to set for this directory.

smbProperties FileSmbProperties

Optional SMB properties to set for the subdirectory.

filePermission string

Optional file permission to set for the subdirectory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryClient>

A Azure.Response<> referencing the newly created directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

CreateSubdirectoryAsync(string, IDictionary<string, string>, FileSmbProperties, string, CancellationToken)

The CreateSubdirectoryAsync(string, IDictionary<string, string>, FileSmbProperties, string, CancellationToken) operation creates a new subdirectory under this directory.

For more information, see Create Directory.

public virtual Task<Response<ShareDirectoryClient>> CreateSubdirectoryAsync(string subdirectoryName, IDictionary<string, string> metadata = null, FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

subdirectoryName string

The name of the subdirectory.

metadata IDictionary<string, string>

Optional custom metadata to set for the subdirectory.

smbProperties FileSmbProperties

Optional SMB properties to set for the subdirectory.

filePermission string

Optional file permission to set for the subdirectory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryClient>>

A Azure.Response<> referencing the newly created directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

Delete(CancellationToken)

The Delete(CancellationToken) operation removes the specified empty directory.

For more information, see Delete Directory.

public virtual Response Delete(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response

A Azure.Response if successful.

Remarks

Note that the directory must be empty before it can be deleted.

DeleteAsync(CancellationToken)

The DeleteAsync(CancellationToken) operation removes the specified empty directory.

For more information, see Delete Directory.

public virtual Task<Response> DeleteAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response>

A Azure.Response if successful.

Remarks

Note that the directory must be empty before it can be deleted.

DeleteFile(string, ShareFileRequestConditions, CancellationToken)

The DeleteFile(string, ShareFileRequestConditions, CancellationToken) operation immediately removes the file from the storage account.

For more information, see Delete File.

public virtual Response DeleteFile(string fileName, ShareFileRequestConditions conditions = null, CancellationToken cancellationToken = default)

Parameters

fileName string

The name of the file.

conditions ShareFileRequestConditions

Optional ShareFileRequestConditions to add conditions on creating the file.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response

A Azure.Response on successfully deleting.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

DeleteFileAsync(string, ShareFileRequestConditions, CancellationToken)

The DeleteFile(string, ShareFileRequestConditions, CancellationToken) operation immediately removes the file from the storage account.

For more information, see Delete File.

public virtual Task<Response> DeleteFileAsync(string fileName, ShareFileRequestConditions conditions = null, CancellationToken cancellationToken = default)

Parameters

fileName string

The name of the file.

conditions ShareFileRequestConditions

Optional ShareFileRequestConditions to add conditions on creating the file.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response>

A Azure.Response on successfully deleting.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

DeleteIfExists(CancellationToken)

The DeleteIfExists(CancellationToken) operation removes the specified empty directory, if it exists.

For more information, see Delete Directory.

public virtual Response<bool> DeleteIfExists(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<bool>

True if the directory existed.

Remarks

Note that the directory must be empty before it can be deleted.

DeleteIfExistsAsync(CancellationToken)

The DeleteIfExistsAsync(CancellationToken) operation removes the specified empty directory, if it exists.

For more information, see Delete Directory.

public virtual Task<Response<bool>> DeleteIfExistsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<bool>>

True if the directory existed.

Remarks

Note that the directory must be empty before it can be deleted.

DeleteSubdirectory(string, CancellationToken)

The DeleteSubdirectory(string, CancellationToken) operation removes the specified empty subdirectory.

For more information, see Delete Directory.

public virtual Response DeleteSubdirectory(string subdirectoryName, CancellationToken cancellationToken = default)

Parameters

subdirectoryName string

The name of the subdirectory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response

A Azure.Response if successful.

Remarks

Note that the directory must be empty before it can be deleted.

DeleteSubdirectoryAsync(string, CancellationToken)

The DeleteSubdirectoryAsync(string, CancellationToken) operation removes the specified empty subdirectory.

For more information, see Delete Directory.

public virtual Task<Response> DeleteSubdirectoryAsync(string subdirectoryName, CancellationToken cancellationToken = default)

Parameters

subdirectoryName string

The name of the subdirectory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response>

A Azure.Response if successful.

Remarks

Note that the directory must be empty before it can be deleted.

Exists(CancellationToken)

The Exists(CancellationToken) operation can be called on a ShareDirectoryClient to see if the associated directory exists in the share on the storage account in the storage service.

public virtual Response<bool> Exists(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<bool>

Returns true if the directory exists.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

ExistsAsync(CancellationToken)

The Exists(CancellationToken) operation can be called on a ShareDirectoryClient to see if the associated directory exists in the share on the storage account in the storage service.

public virtual Task<Response<bool>> ExistsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<bool>>

Returns true if the directory exists.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

ForceCloseAllHandles(bool?, CancellationToken)

The ForceCloseAllHandles(bool?, CancellationToken) operation closes all handles opened on a directory or a file at the service. It optionally supports recursively closing handles on subresources when the resource is a directory.

This API is intended to be used alongside GetHandles(bool?, CancellationToken) to force close handles that block operations, such as renaming a directory. These handles may have leaked or been lost track of by SMB clients. The API has client-side impact on the handle being closed, including user visible errors due to failed attempts to read or write files. This API is not intended for use as a replacement or alternative for SMB close.

For more information, see Force Close Handles.

public virtual CloseHandlesResult ForceCloseAllHandles(bool? recursive = null, CancellationToken cancellationToken = default)

Parameters

recursive bool?

Optional. A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

CloseHandlesResult

A CloseHandlesResult describing the status of the ForceCloseAllHandles(bool?, CancellationToken) operation.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

ForceCloseAllHandlesAsync(bool?, CancellationToken)

The ForceCloseAllHandlesAsync(bool?, CancellationToken) operation closes all handles opened on a directory or a file at the service. It optionally supports recursively closing handles on subresources when the resource is a directory.

This API is intended to be used alongside GetHandlesAsync(bool?, CancellationToken) to force close handles that block operations, such as renaming a directory. These handles may have leaked or been lost track of by SMB clients. The API has client-side impact on the handle being closed, including user visible errors due to failed attempts to read or write files. This API is not intended for use as a replacement or alternative for SMB close.

FFor more information, see Force Close Handles.

public virtual Task<CloseHandlesResult> ForceCloseAllHandlesAsync(bool? recursive = null, CancellationToken cancellationToken = default)

Parameters

recursive bool?

Optional. A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<CloseHandlesResult>

A CloseHandlesResult describing the status of the ForceCloseAllHandlesAsync(bool?, CancellationToken) operation.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

ForceCloseHandle(string, CancellationToken)

The ForceCloseHandle(string, CancellationToken) operation closes a handle opened on a directory or a file at the service. It supports closing a single handle specified by handleId.

This API is intended to be used alongside GetHandles(bool?, CancellationToken) to force close handles that block operations, such as renaming a directory. These handles may have leaked or been lost track of by SMB clients. The API has client-side impact on the handle being closed, including user visible errors due to failed attempts to read or write files. This API is not intended for use as a replacement or alternative for SMB close.

For more information, see Force Close Handles.

public virtual Response<CloseHandlesResult> ForceCloseHandle(string handleId, CancellationToken cancellationToken = default)

Parameters

handleId string

Specifies the handle ID to be closed.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<CloseHandlesResult>

A Azure.Response<> describing the status of the ForceCloseHandle(string, CancellationToken) operation.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

ForceCloseHandleAsync(string, CancellationToken)

The ForceCloseHandle(string, CancellationToken) operation closes a handle opened on a directory or a file at the service. It supports closing a single handle specified by handleId.

This API is intended to be used alongside GetHandlesAsync(bool?, CancellationToken) to force close handles that block operations, such as renaming a directory. These handles may have leaked or been lost track of by SMB clients. The API has client-side impact on the handle being closed, including user visible errors due to failed attempts to read or write files. This API is not intended for use as a replacement or alternative for SMB close.

For more information, see Force Close Handles.

public virtual Task<Response<CloseHandlesResult>> ForceCloseHandleAsync(string handleId, CancellationToken cancellationToken = default)

Parameters

handleId string

Specifies the handle ID to be closed.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<CloseHandlesResult>>

A Azure.Response<> describing the status of the ForceCloseHandleAsync(string, CancellationToken) operation.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GenerateSasUri(ShareFileSasPermissions, DateTimeOffset)

The GenerateSasUri(ShareFileSasPermissions, DateTimeOffset) returns a Uri that generates a Share Directory Service Shared Access Signature (SAS) Uri based on the Client properties and parameters passed. The SAS is signed by the shared key credential of the client.

To check if the client is able to sign a Service Sas see CanGenerateSasUri.

For more information, see Constructing a service SAS.

public virtual Uri GenerateSasUri(ShareFileSasPermissions permissions, DateTimeOffset expiresOn)

Parameters

permissions ShareFileSasPermissions

Required. Specifies the list of permissions to be associated with the SAS. See ShareFileSasPermissions.

expiresOn DateTimeOffset

Required. Specifies the time at which the SAS becomes invalid. This field must be omitted if it has been specified in an associated stored access policy.

Returns

Uri

A Uri containing the SAS Uri.

Remarks

A Exception will be thrown if a failure occurs.

GenerateSasUri(ShareSasBuilder)

The GenerateSasUri(ShareSasBuilder) returns a Uri that generates a Share Directory Service Shared Access Signature (SAS) Uri based on the Client properties and and builder. The SAS is signed by the shared key credential of the client.

To check if the client is able to sign a Service Sas see CanGenerateSasUri.

For more information, see Constructing a Service SAS.

public virtual Uri GenerateSasUri(ShareSasBuilder builder)

Parameters

builder ShareSasBuilder

Used to generate a Shared Access Signature (SAS)

Returns

Uri

A Uri containing the SAS Uri.

Remarks

A Exception will be thrown if a failure occurs.

GetFileClient(string)

Creates a new ShareFileClient object by appending fileName to the end of Uri. The new ShareFileClient uses the same request policy pipeline as the ShareDirectoryClient.

public virtual ShareFileClient GetFileClient(string fileName)

Parameters

fileName string

The name of the file.

Returns

ShareFileClient

A new ShareFileClient instance.

GetFilesAndDirectories(ShareDirectoryGetFilesAndDirectoriesOptions, CancellationToken)

The GetFilesAndDirectoriesAsync(ShareDirectoryGetFilesAndDirectoriesOptions, CancellationToken) operation returns an async sequence of files and subdirectories in this directory. Enumerating the files and directories may make multiple requests to the service while fetching all the values.

For more information, see List Directories and Files.

public virtual Pageable<ShareFileItem> GetFilesAndDirectories(ShareDirectoryGetFilesAndDirectoriesOptions options = null, CancellationToken cancellationToken = default)

Parameters

options ShareDirectoryGetFilesAndDirectoriesOptions

Optional parameters. ShareDirectoryGetFilesAndDirectoriesOptions.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Pageable<ShareFileItem>

An IEnumerable<T> of Azure.Response<> describing the items in the directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetFilesAndDirectories(string, CancellationToken)

The GetFilesAndDirectories(string, CancellationToken) operation returns an async sequence of files and subdirectories in this directory. Enumerating the files and directories may make multiple requests to the service while fetching all the values.

For more information, see List Directories and Files.

public virtual Pageable<ShareFileItem> GetFilesAndDirectories(string prefix, CancellationToken cancellationToken = default)

Parameters

prefix string

Optional string that filters the results to return only files and directories whose name begins with the specified prefix.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Pageable<ShareFileItem>

An IEnumerable<T> of Azure.Response<> describing the items in the directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetFilesAndDirectoriesAsync(ShareDirectoryGetFilesAndDirectoriesOptions, CancellationToken)

The GetFilesAndDirectoriesAsync(ShareDirectoryGetFilesAndDirectoriesOptions, CancellationToken) operation returns an async collection of files and subdirectories in this directory. Enumerating the files and directories may make multiple requests to the service while fetching all the values.

For more information, see List Directories and Files.

public virtual AsyncPageable<ShareFileItem> GetFilesAndDirectoriesAsync(ShareDirectoryGetFilesAndDirectoriesOptions options = null, CancellationToken cancellationToken = default)

Parameters

options ShareDirectoryGetFilesAndDirectoriesOptions

Optional parameters. ShareDirectoryGetFilesAndDirectoriesOptions.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

AsyncPageable<ShareFileItem>

A Azure.AsyncPageable<> describing the items in the directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetFilesAndDirectoriesAsync(string, CancellationToken)

The GetFilesAndDirectoriesAsync(string, CancellationToken) operation returns an async collection of files and subdirectories in this directory. Enumerating the files and directories may make multiple requests to the service while fetching all the values.

For more information, see List Directories and Files.

public virtual AsyncPageable<ShareFileItem> GetFilesAndDirectoriesAsync(string prefix, CancellationToken cancellationToken = default)

Parameters

prefix string

Optional string that filters the results to return only files and directories whose name begins with the specified prefix.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

AsyncPageable<ShareFileItem>

A Azure.AsyncPageable<> describing the items in the directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetHandles(bool?, CancellationToken)

The GetHandles(bool?, CancellationToken) operation returns an async sequence of the open handles on a directory or a file. Enumerating the handles may make multiple requests to the service while fetching all the values.

For more information, see List Handles.

public virtual Pageable<ShareFileHandle> GetHandles(bool? recursive = null, CancellationToken cancellationToken = default)

Parameters

recursive bool?

Optional. A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Pageable<ShareFileHandle>

An IEnumerable<T> of Azure.Response<> describing the handles in the directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetHandlesAsync(bool?, CancellationToken)

The GetHandlesAsync(bool?, CancellationToken) operation returns an async sequence of the open handles on a directory or a file. Enumerating the handles may make multiple requests to the service while fetching all the values.

For more information, see List Handles.

public virtual AsyncPageable<ShareFileHandle> GetHandlesAsync(bool? recursive = null, CancellationToken cancellationToken = default)

Parameters

recursive bool?

Optional. A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

AsyncPageable<ShareFileHandle>

A Azure.AsyncPageable<> describing the handles on the directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetParentDirectoryClientCore()

Create a new ShareDirectoryClient that pointing to this ShareFileClient's parent container. The new ShareDirectoryClient uses the same request policy pipeline as the ShareFileClient.

protected virtual ShareDirectoryClient GetParentDirectoryClientCore()

Returns

ShareDirectoryClient

A new ShareFileClient instance.

GetParentShareClientCore()

Create a new ShareClient that pointing to this ShareFileClient's parent container. The new ShareClient uses the same request policy pipeline as the ShareFileClient.

protected virtual ShareClient GetParentShareClientCore()

Returns

ShareClient

A new ShareFileClient instance.

GetProperties(CancellationToken)

The GetProperties(CancellationToken) operation returns all user-defined metadata and system properties for the specified directory. The data returned does not include the directory's list of subdirectories or files.

For more information, see Get Directory Properties.

public virtual Response<ShareDirectoryProperties> GetProperties(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryProperties>

A Azure.Response<> describing the directory and its properties.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetPropertiesAsync(CancellationToken)

The GetPropertiesAsync(CancellationToken) operation returns all user-defined metadata and system properties for the specified directory. The data returned does not include the directory's list of subdirectories or files.

For more information, see Get Directory Properties.

public virtual Task<Response<ShareDirectoryProperties>> GetPropertiesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryProperties>>

A Azure.Response<> describing the directory and its properties.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

GetSubdirectoryClient(string)

Creates a new ShareDirectoryClient object by appending subdirectoryName to the end of Uri. The new ShareDirectoryClient uses the same request policy pipeline as the ShareDirectoryClient.

public virtual ShareDirectoryClient GetSubdirectoryClient(string subdirectoryName)

Parameters

subdirectoryName string

The name of the subdirectory.

Returns

ShareDirectoryClient

A new ShareDirectoryClient instance.

Rename(string, ShareFileRenameOptions, CancellationToken)

Renames a directory. This API does not support renaming a directory from one share to another, or between storage accounts.

public virtual Response<ShareDirectoryClient> Rename(string destinationPath, ShareFileRenameOptions options = null, CancellationToken cancellationToken = default)

Parameters

destinationPath string

The destination path to rename the directory to.

options ShareFileRenameOptions

Optional parameters.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryClient>

A Azure.Response<> pointed at the newly renamed directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

RenameAsync(string, ShareFileRenameOptions, CancellationToken)

Renames a directory. This API does not support renaming a directory from one share to another, or between storage accounts.

public virtual Task<Response<ShareDirectoryClient>> RenameAsync(string destinationPath, ShareFileRenameOptions options = null, CancellationToken cancellationToken = default)

Parameters

destinationPath string

The destination path to rename the directory to.

options ShareFileRenameOptions

Optional parameters.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryClient>>

A Azure.Response<> pointed at the newly renamed directory.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

SetHttpHeaders(FileSmbProperties, string, CancellationToken)

The SetHttpHeaders(FileSmbProperties, string, CancellationToken) operation sets system properties on the directory.

For more information, see Set Directory Properties.

public virtual Response<ShareDirectoryInfo> SetHttpHeaders(FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

smbProperties FileSmbProperties

Optional SMB properties to set for the directory.

filePermission string

Optional file permission to set for the directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryInfo>

A Azure.Response<> describing the state of the file.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

SetHttpHeadersAsync(FileSmbProperties, string, CancellationToken)

The SetHttpHeadersAsync(FileSmbProperties, string, CancellationToken) operation sets system properties on the directory.

For more information, see Set Directory Properties.

public virtual Task<Response<ShareDirectoryInfo>> SetHttpHeadersAsync(FileSmbProperties smbProperties = null, string filePermission = null, CancellationToken cancellationToken = default)

Parameters

smbProperties FileSmbProperties

Optional SMB properties to set for the directory.

filePermission string

Optional file permission to set for the directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryInfo>>

A Azure.Response<> describing the state of the file.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

SetMetadata(IDictionary<string, string>, CancellationToken)

The SetMetadata(IDictionary<string, string>, CancellationToken) operation sets one or more user-defined name-value pairs for the specified directory.

For more information, see Set Directory Metadata.

public virtual Response<ShareDirectoryInfo> SetMetadata(IDictionary<string, string> metadata, CancellationToken cancellationToken = default)

Parameters

metadata IDictionary<string, string>

Custom metadata to set for this directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Response<ShareDirectoryInfo>

A Azure.Response<> if successful.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

SetMetadataAsync(IDictionary<string, string>, CancellationToken)

The SetMetadataAsync(IDictionary<string, string>, CancellationToken) operation sets one or more user-defined name-value pairs for the specified directory.

For more information, see Set Directory Metadata.

public virtual Task<Response<ShareDirectoryInfo>> SetMetadataAsync(IDictionary<string, string> metadata, CancellationToken cancellationToken = default)

Parameters

metadata IDictionary<string, string>

Custom metadata to set for this directory.

cancellationToken CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

Task<Response<ShareDirectoryInfo>>

A Azure.Response<> if successful.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs.

WithSnapshot(string)

Initializes a new instance of the ShareDirectoryClient class with an identical Uri source but the specified snapshot timestamp.

For more information, see Snapshot Share.

public virtual ShareDirectoryClient WithSnapshot(string snapshot)

Parameters

snapshot string

The snapshot identifier.

Returns

ShareDirectoryClient

A new ShareDirectoryClient instance.

Remarks

Pass null or empty string to remove the snapshot returning a URL to the base directory.