Share via


ShareServiceClient.GetShares Method

Definition

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.

public virtual Azure.Pageable<Azure.Storage.Files.Shares.Models.ShareItem> GetShares (Azure.Storage.Files.Shares.Models.ShareTraits traits = Azure.Storage.Files.Shares.Models.ShareTraits.None, Azure.Storage.Files.Shares.Models.ShareStates states = Azure.Storage.Files.Shares.Models.ShareStates.None, string prefix = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetShares : Azure.Storage.Files.Shares.Models.ShareTraits * Azure.Storage.Files.Shares.Models.ShareStates * string * System.Threading.CancellationToken -> Azure.Pageable<Azure.Storage.Files.Shares.Models.ShareItem>
override this.GetShares : Azure.Storage.Files.Shares.Models.ShareTraits * Azure.Storage.Files.Shares.Models.ShareStates * string * System.Threading.CancellationToken -> Azure.Pageable<Azure.Storage.Files.Shares.Models.ShareItem>
Public Overridable Function GetShares (Optional traits As ShareTraits = Azure.Storage.Files.Shares.Models.ShareTraits.None, Optional states As ShareStates = Azure.Storage.Files.Shares.Models.ShareStates.None, Optional prefix As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of ShareItem)

Parameters

traits
ShareTraits

Specifies traits to include in the ShareItems.

states
ShareStates

Specifies states to include when listing shares.

prefix
String

String that filters the results to return only shares whose name begins with the specified prefix.

cancellationToken
CancellationToken

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

Returns

An IEnumerable<T> of Response<T> describing the shares in the storage account.

Remarks

A RequestFailedException will be thrown if a failure occurs.

Applies to