Share via


ShareServiceClient Class

Definition

The ShareServiceClient allows you to manipulate Azure Storage service resources and shares. The storage account provides the top-level namespace for the File service.

public class ShareServiceClient
type ShareServiceClient = class
Public Class ShareServiceClient
Inheritance
ShareServiceClient

Constructors

ShareServiceClient()

Initializes a new instance of the ShareServiceClient class for mocking.

ShareServiceClient(String, ShareClientOptions)

Initializes a new instance of the ShareServiceClient class.

ShareServiceClient(String)

Initializes a new instance of the ShareServiceClient class.

ShareServiceClient(Uri, AzureSasCredential, ShareClientOptions)

Initializes a new instance of the ShareServiceClient class.

ShareServiceClient(Uri, ShareClientOptions)

Initializes a new instance of the ShareServiceClient class.

ShareServiceClient(Uri, StorageSharedKeyCredential, ShareClientOptions)

Initializes a new instance of the ShareServiceClient class.

ShareServiceClient(Uri, TokenCredential, ShareClientOptions)

Initializes a new instance of the ShareServiceClient class.

Note that service-level operations do not support token credential authentication. This constructor exists to 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 file service client.

CanGenerateAccountSasUri

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

Uri

Gets the file service's primary Uri endpoint.

Methods

CreateShare(String, ShareCreateOptions, CancellationToken)

The CreateShare(String, 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.

CreateShareAsync(String, ShareCreateOptions, CancellationToken)

The CreateShare(String, 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.

DeleteShare(String, 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.

Currently, this method will always delete snapshots. There's no way to specify a separate value for x-ms-delete-snapshots.

For more information, see Delete Share.

DeleteShareAsync(String, 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.

Currently, this method will always delete snapshots. There's no way to specify a separate value for x-ms-delete-snapshots.

For more information, see Delete Share.

GenerateAccountSasUri(AccountSasBuilder)

The GenerateAccountSasUri(AccountSasBuilder) returns a Uri that generates a Share Account Shared Access Signature (SAS) 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 CanGenerateAccountSasUri.

For more information, see Constructing an Account SAS.

GenerateAccountSasUri(AccountSasPermissions, DateTimeOffset, AccountSasResourceTypes)

The GenerateAccountSasUri(AccountSasPermissions, DateTimeOffset, AccountSasResourceTypes) returns a Uri that generates a Share Account Shared Access Signature (SAS) 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 CanGenerateAccountSasUri.

For more information, see Constructing an Account SAS.

GetProperties(CancellationToken)

The GetProperties(CancellationToken) operation gets the properties of a storage account’s file service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.

For more information, see Get File Service Properties.

GetPropertiesAsync(CancellationToken)

The GetPropertiesAsync(CancellationToken) operation gets the properties of a storage account’s file service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.

For more information, see Get File Service Properties.

GetShareClient(String)

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

GetShares(ShareTraits, ShareStates, String, CancellationToken)

The GetShares(ShareTraits, ShareStates, String, CancellationToken) operation returns an async sequence of the shares in the storage account. Enumerating the shares may make multiple requests to the service while fetching all the values.

For more information, see List Shares.

GetSharesAsync(ShareTraits, ShareStates, String, CancellationToken)

The GetSharesAsync(ShareTraits, ShareStates, String, CancellationToken) operation returns an async collection of the shares in the storage account. Enumerating the shares may make multiple requests to the service while fetching all the values.

For more information, see List Shares.

SetProperties(ShareServiceProperties, CancellationToken)

The SetProperties(ShareServiceProperties, CancellationToken) operation sets properties for a storage account’s File service endpoint, including properties for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings. You can also use this operation to set the default request version for all incoming requests to the File service that do not have a version specified.

For more information, see Set File Service Properties.

SetPropertiesAsync(ShareServiceProperties, CancellationToken)

The SetPropertiesAsync(ShareServiceProperties, CancellationToken) operation sets properties for a storage account’s File service endpoint, including properties for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings. You can also use this operation to set the default request version for all incoming requests to the File service that do not have a version specified.

For more information, see Set File Service Properties.

UndeleteShare(String, String, CancellationToken)

Restores a previously deleted Share. This API is only functional is Share Soft Delete is enabled for the storage account associated with the share.

UndeleteShareAsync(String, String, CancellationToken)

Restores a previously deleted Share. This API is only functional is Share Soft Delete is enabled for the storage account associated with the share.

Applies to