ShareClient Class

Definition

The ShareClient allows you to manipulate Azure Storage shares and their directories and files.

public class ShareClient
type ShareClient = class
Public Class ShareClient
Inheritance
ShareClient

Constructors

ShareClient()

Initializes a new instance of the ShareClient class for mocking.

ShareClient(String, String)

Initializes a new instance of the ShareClient class.

ShareClient(String, String, ShareClientOptions)

Initializes a new instance of the ShareClient class.

ShareClient(Uri, AzureSasCredential, ShareClientOptions)

Initializes a new instance of the ShareClient class.

Note that token credential authentication is only compatible with the GetPermission(String, CancellationToken), GetPermissionAsync(String, CancellationToken), CreatePermission(String, CancellationToken), and CreatePermissionAsync(String, CancellationToken) share-level operations.

ShareClient(Uri, ShareClientOptions)

Initializes a new instance of the ShareClient class.

ShareClient(Uri, StorageSharedKeyCredential, ShareClientOptions)

Initializes a new instance of the ShareClient class.

ShareClient(Uri, TokenCredential, ShareClientOptions)

Initializes a new instance of the ShareClient class.

Note that the only share-level operations that support token credential authentication are CreatePermission(String, CancellationToken), CreatePermissionAsync(String, CancellationToken), GetPermission(String, CancellationToken), and GetPermissionAsync(String, CancellationToken).

This constructor also allow the construction of a ShareServiceClient that can be used to derive a ShareClient that has token credential authentication.

Also note that ShareTokenIntent is currently required for token authentication.

Properties

AccountName

Gets the Storage account name corresponding to the share 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 share.

Uri

Gets the share's primary Uri endpoint.

Methods

Create(ShareCreateOptions, CancellationToken)

The Create(ShareCreateOptions, CancellationToken) operation creates a new share under the specified account. If a share with the same name already exists, the operation fails.

For more information, see Create Share.

CreateAsync(ShareCreateOptions, CancellationToken)

The CreateAsync(ShareCreateOptions, CancellationToken) operation creates a new share under the specified account. If a share with the same name already exists, the operation fails.

For more information, see Create Share.

CreateDirectory(String, IDictionary<String,String>, FileSmbProperties, String, CancellationToken)

The CreateDirectory(String, IDictionary<String,String>, FileSmbProperties, String, CancellationToken) operation creates a new directory in this share.

For more information, see Create Directory.

CreateDirectoryAsync(String, IDictionary<String,String>, FileSmbProperties, String, CancellationToken)

The CreateDirectoryAsync(String, IDictionary<String,String>, FileSmbProperties, String, CancellationToken) operation creates a new directory in this share.

For more information, see Create Directory.

CreateIfNotExists(ShareCreateOptions, CancellationToken)

The CreateIfNotExists(ShareCreateOptions, CancellationToken) operation creates a new share under the specified account. If a share with the same name already exists, it is not changed.

For more information, see Create Share.

CreateIfNotExistsAsync(IDictionary<String,String>, Nullable<Int32>, CancellationToken)

The CreateIfNotExistsAsync(IDictionary<String,String>, Nullable<Int32>, CancellationToken) operation creates a new share under the specified account. If a share with the same name already exists, it is not changed.

For more information, see Create Share.

CreateIfNotExistsAsync(ShareCreateOptions, CancellationToken)

The CreateIfNotExistsAsync(IDictionary<String,String>, Nullable<Int32>, CancellationToken) operation creates a new share under the specified account. If a share with the same name already exists, it is not changed.

For more information, see Create Share.

CreatePermission(String, CancellationToken)

Creates a permission (a security descriptor) at the share level. The created security descriptor can be used for the files/directories in the share.

CreatePermissionAsync(String, CancellationToken)

Creates a permission (a security descriptor) at the share level. The created security descriptor can be used for the files/directories in the share.

CreateSnapshot(IDictionary<String,String>, CancellationToken)

Creates a read-only snapshot of a share.

For more information, see Snapshot Share.

CreateSnapshotAsync(IDictionary<String,String>, CancellationToken)

Creates a read-only snapshot of a share.

For more information, see Snapshot Share.

Delete(ShareDeleteOptions, CancellationToken)

Marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection which could take several minutes.

For more information, see Delete Share.

DeleteAsync(ShareDeleteOptions, CancellationToken)

Marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection which could take several minutes.

For more information, see Delete Share.

DeleteDirectory(String, CancellationToken)

The DeleteDirectory(String, CancellationToken) operation removes the specified empty directory.

For more information, see Delete Directory.

DeleteDirectoryAsync(String, CancellationToken)

The DeleteDirectoryAsync(String, CancellationToken) operation removes the specified empty directory.

For more information, see Delete Directory.

DeleteIfExists(ShareDeleteOptions, CancellationToken)

Marks the specified share or share snapshot for deletion, if it exists.

For more information, see Delete Share.

DeleteIfExistsAsync(ShareDeleteOptions, CancellationToken)

Marks the specified share or share snapshot for deletion, if it exists.

For more information, see Delete Share.

Exists(CancellationToken)

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

ExistsAsync(CancellationToken)

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

GenerateSasUri(ShareSasBuilder)

The GenerateSasUri(ShareSasBuilder) returns a Uri that generates a Blob Container Service Shared Access Signature (SAS) Uri based on the Client properties and builder 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(ShareSasPermissions, DateTimeOffset)

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

GetAccessPolicy(ShareFileRequestConditions, CancellationToken)

The GetAccessPolicy(ShareFileRequestConditions, CancellationToken) operation gets the permissions for this share. The permissions indicate whether share data may be accessed publicly.

For more information, see Get Share ACL.

GetAccessPolicyAsync(ShareFileRequestConditions, CancellationToken)

The GetAccessPolicyAsync(ShareFileRequestConditions, CancellationToken) operation gets the permissions for this share. The permissions indicate whether share data may be accessed publicly.

For more information, see Get Share ACL.

GetDirectoryClient(String)

Create a new ShareDirectoryClient object by appending directoryName to the end of Uri. The new ShareDirectoryClient uses the same request policy pipeline as the ShareClient.

GetParentServiceClientCore()

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

GetPermission(String, CancellationToken)

Gets the file permission in Security Descriptor Definition Language (SDDL). Note that this API is not applicable for Share Snapshots.

GetPermissionAsync(String, CancellationToken)

Gets the file permission in Security Descriptor Definition Language (SDDL). Note that this API is not applicable for Share Snapshots.

GetProperties(ShareFileRequestConditions, CancellationToken)

The GetProperties(ShareFileRequestConditions, CancellationToken) operation returns all user-defined metadata, standard HTTP properties, and system properties for the share.

For more information, see Get Share Properties.

GetPropertiesAsync(ShareFileRequestConditions, CancellationToken)

The GetPropertiesAsync(ShareFileRequestConditions, CancellationToken) operation returns all user-defined metadata, standard HTTP properties, and system properties for the share.

For more information, see Get Share Properties.

GetRootDirectoryClient()

Create a ShareDirectoryClient object for the root of the share. The new ShareDirectoryClient uses the same request policy pipeline as the ShareClient.

GetStatistics(ShareFileRequestConditions, CancellationToken)

Retrieves statistics related to the share.

For more information, see Get Share Stats.

GetStatisticsAsync(ShareFileRequestConditions, CancellationToken)

Retrieves statistics related to the share.

For more information, see Get Share Stats.

SetAccessPolicy(IEnumerable<ShareSignedIdentifier>, ShareFileRequestConditions, CancellationToken)

The SetAccessPolicy(IEnumerable<ShareSignedIdentifier>, ShareFileRequestConditions, CancellationToken) operation sets the permissions for the specified share. The permissions indicate whether share data may be accessed publicly.

For more information, see Set Share ACL.

SetAccessPolicyAsync(IEnumerable<ShareSignedIdentifier>, ShareFileRequestConditions, CancellationToken)

The SetAccessPolicyAsync(IEnumerable<ShareSignedIdentifier>, ShareFileRequestConditions, CancellationToken) operation sets the permissions for the specified share. The permissions indicate whether share data may be accessed publicly.

For more information, see Set Share ACL.

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

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

For more information, see Set Share Metadata.

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

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

For more information, see Set Share Metadata.

SetProperties(ShareSetPropertiesOptions, CancellationToken)

Sets properties of the share.

For more information, see Set Share Properties.

SetPropertiesAsync(ShareSetPropertiesOptions, CancellationToken)

Sets properties of the share.

For more information, see Set Share Properties.

WithSnapshot(String)

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

For more information, see Snapshot Share.

Extension Methods

GetShareLeaseClient(ShareClient, String)

Initializes a new instance of the ShareLeaseClient class.

GetParentServiceClient(ShareClient)

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

Applies to