ShareFileClient Class

Definition

The ShareFileClient allows you to manipulate Azure Storage files.

public class ShareFileClient
type ShareFileClient = class
Public Class ShareFileClient
Inheritance
ShareFileClient

Constructors

ShareFileClient()

Initializes a new instance of the ShareFileClient class for mocking.

ShareFileClient(String, String, String)

Initializes a new instance of the ShareFileClient class.

ShareFileClient(String, String, String, ShareClientOptions)

Initializes a new instance of the ShareFileClient class.

ShareFileClient(Uri, AzureSasCredential, ShareClientOptions)

Initializes a new instance of the ShareFileClient class.

ShareFileClient(Uri, ShareClientOptions)

Initializes a new instance of the ShareFileClient class.

ShareFileClient(Uri, StorageSharedKeyCredential, ShareClientOptions)

Initializes a new instance of the ShareFileClient class.

Properties

AccountName

Gets the Storage account name corresponding to the file client.

CanGenerateSasUri

Determines whether the client is able to generate a SAS. If the client is authenticated with a StorageSharedKeyCredential.

Name

Gets the name of the file.

Path

Gets the path of the file.

ShareName

Gets the share name corresponding to the file client.

Uri

Gets the directory's primary Uri endpoint.

Methods

AbortCopy(String, ShareFileRequestConditions, CancellationToken)

Attempts to cancel a pending copy that was previously started and leaves a destination file with zero length and full metadata.

For more information, see Abort Copy File.

AbortCopyAsync(String, ShareFileRequestConditions, CancellationToken)

Attempts to cancel a pending copy that was previously started and leaves a destination file with zero length and full metadata.

For more information, see Abort Copy File.

ClearRange(HttpRange, ShareFileRequestConditions, CancellationToken)

The ClearRange(HttpRange, ShareFileRequestConditions, CancellationToken) operation clears the range of a file.

For more information, see Put Range.

ClearRangeAsync(HttpRange, ShareFileRequestConditions, CancellationToken)

The ClearRangeAsync(HttpRange, ShareFileRequestConditions, CancellationToken) operation clears the range of a file.

For more information, see Put Range.

Create(Int64, ShareFileHttpHeaders, IDictionary<String,String>, FileSmbProperties, String, ShareFileRequestConditions, CancellationToken)

Creates a new file or replaces an existing file.

For more information, see Create File.

CreateAsync(Int64, ShareFileHttpHeaders, IDictionary<String,String>, FileSmbProperties, String, ShareFileRequestConditions, CancellationToken)

Creates a new file or replaces an existing file.

For more information, see Create File.

Delete(ShareFileRequestConditions, CancellationToken)

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

For more information, see Delete File.

DeleteAsync(ShareFileRequestConditions, CancellationToken)

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

For more information, see Delete File.

DeleteIfExists(ShareFileRequestConditions, CancellationToken)

The DeleteIfExists(ShareFileRequestConditions, CancellationToken) operation immediately removes the file from the storage account, if it exists.

For more information, see Delete File.

DeleteIfExistsAsync(ShareFileRequestConditions, CancellationToken)

The DeleteIfExists(ShareFileRequestConditions, CancellationToken) operation immediately removes the file from the storage account, if it exists.

For more information, see Delete File.

Download(HttpRange, Boolean, ShareFileRequestConditions, CancellationToken)

The Download(HttpRange, Boolean, ShareFileRequestConditions, CancellationToken) operation reads or downloads a file from the system, including its metadata and properties.

For more information, see Get File.

DownloadAsync(HttpRange, Boolean, ShareFileRequestConditions, CancellationToken)

The DownloadAsync(HttpRange, Boolean, ShareFileRequestConditions, CancellationToken) operation reads or downloads a file from the system, including its metadata and properties.

For more information, see Get File.

Exists(CancellationToken)

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

ExistsAsync(CancellationToken)

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

ForceCloseAllHandles(CancellationToken)

The ForceCloseAllHandles(CancellationToken) operation closes all handles opened on a file at the service.

This API is intended to be used alongside GetHandlesAsync(CancellationToken) to force close handles that block operations. 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.

ForceCloseAllHandlesAsync(CancellationToken)

The ForceCloseAllHandlesAsync(CancellationToken) operation closes all handles opened on a file at the service.

This API is intended to be used alongside GetHandlesAsync(CancellationToken) to force close handles that block operations. 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.

ForceCloseHandle(String, CancellationToken)

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

This API is intended to be used alongside GetHandlesAsync(CancellationToken) to force close handles that block operations. 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.

ForceCloseHandleAsync(String, CancellationToken)

The ForceCloseHandleAsync(String, CancellationToken) operation closes a handle opened on a file at the service. It supports closing a single handle specified by handleId.

This API is intended to be used alongside GetHandlesAsync(CancellationToken) to force close handles that block operations. 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.

GenerateSasUri(ShareFileSasPermissions, DateTimeOffset)

The GenerateSasUri(ShareFileSasPermissions, DateTimeOffset) returns a Uri that generates a Share File 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.

GenerateSasUri(ShareSasBuilder)

The GenerateSasUri(ShareSasBuilder) returns a Uri that generates a Share File 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.

GetHandles(CancellationToken)

The GetHandles(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.

GetHandlesAsync(CancellationToken)

The GetHandlesAsync(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.

GetProperties(ShareFileRequestConditions, CancellationToken)

The GetProperties(ShareFileRequestConditions, CancellationToken) operation returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file.

For more information, see Get File Properties.

GetPropertiesAsync(ShareFileRequestConditions, CancellationToken)

The GetPropertiesAsync(ShareFileRequestConditions, CancellationToken) operation returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file.

For more information, see Get File Properties.

GetRangeList(ShareFileGetRangeListOptions, CancellationToken)

Returns the list of valid ranges for a file.

For more information, see List Ranges.

GetRangeListAsync(ShareFileGetRangeListOptions, CancellationToken)

Returns the list of valid ranges for a file.

For more information, see List Ranges.

GetRangeListDiff(ShareFileGetRangeListDiffOptions, CancellationToken)

Returns the list of ranges that have changed in the file since previousSnapshot was taken.

For more information, see List Ranges.

GetRangeListDiffAsync(ShareFileGetRangeListDiffOptions, CancellationToken)

Returns the list of ranges that have changed in the file since previousSnapshot was taken.

For more information, see List Ranges.

OpenRead(ShareFileOpenReadOptions, CancellationToken)

Opens a stream for reading from the file. The stream will only download the file as the stream is read from.

OpenReadAsync(ShareFileOpenReadOptions, CancellationToken)

Opens a stream for reading from the file. The stream will only download the file as the stream is read from.

OpenWrite(Boolean, Int64, ShareFileOpenWriteOptions, CancellationToken)

Opens a stream for writing to the file.

OpenWriteAsync(Boolean, Int64, ShareFileOpenWriteOptions, CancellationToken)

Opens a stream for writing to the file.

SetHttpHeaders(Nullable<Int64>, ShareFileHttpHeaders, FileSmbProperties, String, ShareFileRequestConditions, CancellationToken)

The SetHttpHeaders(Nullable<Int64>, ShareFileHttpHeaders, FileSmbProperties, String, ShareFileRequestConditions, CancellationToken) operation sets system properties on the file.

For more information, see Set File Properties.

SetHttpHeadersAsync(Nullable<Int64>, ShareFileHttpHeaders, FileSmbProperties, String, ShareFileRequestConditions, CancellationToken)

The SetHttpHeadersAsync(Nullable<Int64>, ShareFileHttpHeaders, FileSmbProperties, String, ShareFileRequestConditions, CancellationToken) operation sets system properties on the file.

For more information, see Set File Properties.

SetMetadata(IDictionary<String,String>, ShareFileRequestConditions, CancellationToken)

The SetMetadata(IDictionary<String,String>, ShareFileRequestConditions, CancellationToken) operation sets user-defined metadata for the specified file as one or more name-value pairs.

For more information, see Set File Metadata.

SetMetadataAsync(IDictionary<String,String>, ShareFileRequestConditions, CancellationToken)

The SetMetadataAsync(IDictionary<String,String>, ShareFileRequestConditions, CancellationToken) operation sets user-defined metadata for the specified file as one or more name-value pairs.

For more information, see Set File Metadata.

StartCopy(Uri, IDictionary<String,String>, FileSmbProperties, String, Nullable<PermissionCopyMode>, Nullable<Boolean>, Nullable<Boolean>, ShareFileRequestConditions, CancellationToken)

Copies a blob or file to a destination file within the storage account.

For more information, see Copy File.

StartCopyAsync(Uri, IDictionary<String,String>, FileSmbProperties, String, Nullable<PermissionCopyMode>, Nullable<Boolean>, Nullable<Boolean>, ShareFileRequestConditions, CancellationToken)

Copies a blob or file to a destination file within the storage account.

For more information, see Copy File.

Upload(Stream, IProgress<Int64>, ShareFileRequestConditions, CancellationToken)

The Upload(Stream, IProgress<Int64>, ShareFileRequestConditions, CancellationToken) operation writes content to a file.

For more information, see Put Range.

UploadAsync(Stream, IProgress<Int64>, ShareFileRequestConditions, CancellationToken)

The UploadAsync(Stream, IProgress<Int64>, ShareFileRequestConditions, CancellationToken) operation writes content to a file.

For more information, see Put Range.

UploadRange(HttpRange, Stream, Byte[], IProgress<Int64>, ShareFileRequestConditions, CancellationToken)

The UploadRange(HttpRange, Stream, Byte[], IProgress<Int64>, ShareFileRequestConditions, CancellationToken) operation writes content to a range of a file.

For more information, see Put Range.

UploadRangeAsync(HttpRange, Stream, Byte[], IProgress<Int64>, ShareFileRequestConditions, CancellationToken)

The UploadRangeAsync(HttpRange, Stream, Byte[], IProgress<Int64>, ShareFileRequestConditions, CancellationToken) operation writes content to a range of a file.

For more information, see Put Range.

UploadRangeFromUri(Uri, HttpRange, HttpRange, ShareFileUploadRangeFromUriOptions, CancellationToken)

The UploadRangeFromUri(Uri, HttpRange, HttpRange, ShareFileUploadRangeFromUriOptions, CancellationToken) operation writes a range from an Azure File to another Azure file. This API is supported only for version 2019-02-02 and higher.

UploadRangeFromUriAsync(Uri, HttpRange, HttpRange, ShareFileUploadRangeFromUriOptions, CancellationToken)

The Azure.Storage.Files.Shares.ShareFileClient.UploadRangeFromUriAsync(System.Uri,Azure.HttpRange,Azure.HttpRange,Azure.Storage.Files.Shares.Models.ShareFileRequestConditions,System.Threading.CancellationToken) operation writes a range from an Azure File to another Azure file. This API is supported only for version 2019-02-02 and higher.

WithSnapshot(String)

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

For more information, see Snapshot Share.

Extension Methods

GetShareLeaseClient(ShareFileClient, String)

Initializes a new instance of the ShareLeaseClient class.

Applies to