Table of Contents

Class CloudFileClient

Namespace
Microsoft.WindowsAzure.Storage.File
Assembly
Microsoft.WindowsAzure.Storage.dll

Provides a client-side logical representation of the Microsoft Azure File service. This client is used to configure and execute requests against the File service.

public class CloudFileClient
Inheritance
CloudFileClient
Inherited Members

Remarks

The service client encapsulates the base URI for the File service. If the service client will be used for authenticated access, it also encapsulates the credentials for accessing the storage account.

Constructors

CloudFileClient(StorageUri, StorageCredentials)

Initializes a new instance of the CloudFileClient class using the specified File service endpoint and account credentials.

public CloudFileClient(StorageUri storageUri, StorageCredentials credentials)

Parameters

storageUri StorageUri

The File service endpoint to use to create the client.

credentials StorageCredentials

A StorageCredentials object.

CloudFileClient(Uri, StorageCredentials)

Initializes a new instance of the CloudFileClient class using the specified File service endpoint and account credentials.

public CloudFileClient(Uri baseUri, StorageCredentials credentials)

Parameters

baseUri Uri

The File service endpoint to use to create the client.

credentials StorageCredentials

A StorageCredentials object.

Properties

AuthenticationScheme

Gets or sets the authentication scheme to use to sign HTTP requests.

public AuthenticationScheme AuthenticationScheme { get; set; }

Property Value

AuthenticationScheme

BaseUri

Gets the base URI for the File service client.

public Uri BaseUri { get; }

Property Value

Uri

The base URI used to construct the File service client.

BufferManager

Gets or sets a buffer manager that implements the IBufferManager interface, specifying a buffer pool for use with operations against the File service client.

public IBufferManager BufferManager { get; set; }

Property Value

IBufferManager

Credentials

Gets the account credentials used to create the File service client.

public StorageCredentials Credentials { get; }

Property Value

StorageCredentials

The account credentials.

DefaultRequestOptions

Gets or sets the default request options for requests made via the File service client.

public FileRequestOptions DefaultRequestOptions { get; set; }

Property Value

FileRequestOptions

A FileRequestOptions object.

StorageUri

Gets the list of URIs for all locations.

public StorageUri StorageUri { get; }

Property Value

StorageUri

The list of URIs for all locations.

Methods

BeginGetServiceProperties(FileRequestOptions, OperationContext, AsyncCallback, object)

Begins an asynchronous operation to get service properties for the File service.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginGetServiceProperties(FileRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)

Parameters

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

callback AsyncCallback

An AsyncCallback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object to be passed to the callback delegate.

Returns

ICancellableAsyncResult

An ICancellableAsyncResult that references the asynchronous operation.

BeginGetServiceProperties(AsyncCallback, object)

Begins an asynchronous operation to get service properties for the File service.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginGetServiceProperties(AsyncCallback callback, object state)

Parameters

callback AsyncCallback

An AsyncCallback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object to be passed to the callback delegate.

Returns

ICancellableAsyncResult

An ICancellableAsyncResult that references the asynchronous operation.

BeginListSharesSegmented(FileContinuationToken, AsyncCallback, object)

Begins an asynchronous request to return a result segment containing a collection of shares.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginListSharesSegmented(FileContinuationToken currentToken, AsyncCallback callback, object state)

Parameters

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

callback AsyncCallback

The callback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object that will be passed to the callback delegate.

Returns

ICancellableAsyncResult

An IAsyncResult that references the asynchronous operation.

BeginListSharesSegmented(string, FileContinuationToken, AsyncCallback, object)

Begins an asynchronous request to return a result segment containing a collection of shares.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, FileContinuationToken currentToken, AsyncCallback callback, object state)

Parameters

prefix string

The share name prefix.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

callback AsyncCallback

The callback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object that will be passed to the callback delegate.

Returns

ICancellableAsyncResult

An IAsyncResult that references the asynchronous operation.

BeginListSharesSegmented(string, ShareListingDetails, int?, FileContinuationToken, FileRequestOptions, OperationContext, AsyncCallback, object)

Begins an asynchronous request to return a result segment containing a collection of shares whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state)

Parameters

prefix string

The share name prefix.

detailsIncluded ShareListingDetails

A value that indicates whether to return share metadata with the listing.

maxResults int?

A non-negative integer value that indicates the maximum number of results to be returned in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

options FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

callback AsyncCallback

The callback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object that will be passed to the callback delegate.

Returns

ICancellableAsyncResult

An IAsyncResult that references the asynchronous operation.

BeginSetServiceProperties(FileServiceProperties, FileRequestOptions, OperationContext, AsyncCallback, object)

Begins an asynchronous operation to set service properties for the File service.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginSetServiceProperties(FileServiceProperties properties, FileRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

callback AsyncCallback

An AsyncCallback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object to be passed to the callback delegate.

Returns

ICancellableAsyncResult

An ICancellableAsyncResult that references the asynchronous operation.

BeginSetServiceProperties(FileServiceProperties, AsyncCallback, object)

Begins an asynchronous operation to set service properties for the File service.

[DoesServiceRequest]
public virtual ICancellableAsyncResult BeginSetServiceProperties(FileServiceProperties properties, AsyncCallback callback, object state)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

callback AsyncCallback

An AsyncCallback delegate that will receive notification when the asynchronous operation completes.

state object

A user-defined object to be passed to the callback delegate.

Returns

ICancellableAsyncResult

An ICancellableAsyncResult that references the asynchronous operation.

EndGetServiceProperties(IAsyncResult)

Ends an asynchronous operation to get service properties for the File service.

public virtual FileServiceProperties EndGetServiceProperties(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

An IAsyncResult that references the pending asynchronous operation.

Returns

FileServiceProperties

A FileServiceProperties object.

EndListSharesSegmented(IAsyncResult)

Ends an asynchronous operation to return a result segment containing a collection of shares.

public virtual ShareResultSegment EndListSharesSegmented(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

An IAsyncResult that references the pending asynchronous operation.

Returns

ShareResultSegment

A result segment of shares.

EndSetServiceProperties(IAsyncResult)

Ends an asynchronous operation to set service properties for the Blob service.

public virtual void EndSetServiceProperties(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

An IAsyncResult that references the pending asynchronous operation.

GetServiceProperties(FileRequestOptions, OperationContext)

Gets service properties for the File service.

[DoesServiceRequest]
public virtual FileServiceProperties GetServiceProperties(FileRequestOptions requestOptions = null, OperationContext operationContext = null)

Parameters

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

FileServiceProperties

A FileServiceProperties object.

GetServicePropertiesAsync()

Initiates an asynchronous operation to get service properties for the File service.

[DoesServiceRequest]
public virtual Task<FileServiceProperties> GetServicePropertiesAsync()

Returns

Task<FileServiceProperties>

A Task<TResult> object of type FileServiceProperties that represents the asynchronous operation.

GetServicePropertiesAsync(FileRequestOptions, OperationContext)

Initiates an asynchronous operation to get service properties for the File service.

[DoesServiceRequest]
public virtual Task<FileServiceProperties> GetServicePropertiesAsync(FileRequestOptions requestOptions, OperationContext operationContext)

Parameters

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

Task<FileServiceProperties>

A Task<TResult> object of type FileServiceProperties that represents the asynchronous operation.

GetServicePropertiesAsync(FileRequestOptions, OperationContext, CancellationToken)

Initiates an asynchronous operation to get service properties for the File service.

[DoesServiceRequest]
public virtual Task<FileServiceProperties> GetServicePropertiesAsync(FileRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)

Parameters

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<FileServiceProperties>

A Task<TResult> object of type FileServiceProperties that represents the asynchronous operation.

GetServicePropertiesAsync(CancellationToken)

Initiates an asynchronous operation to get service properties for the File service.

[DoesServiceRequest]
public virtual Task<FileServiceProperties> GetServicePropertiesAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<FileServiceProperties>

A Task<TResult> object of type FileServiceProperties that represents the asynchronous operation.

GetShareReference(string)

Returns a reference to a CloudFileShare object with the specified name.

public virtual CloudFileShare GetShareReference(string shareName)

Parameters

shareName string

A string containing the name of the share.

Returns

CloudFileShare

A reference to a share.

GetShareReference(string, DateTimeOffset?)

Returns a reference to a CloudFileShare object with the specified name and snapshot time.

public CloudFileShare GetShareReference(string shareName, DateTimeOffset? snapshotTime)

Parameters

shareName string

A string containing the name of the share.

snapshotTime DateTimeOffset?

A DateTimeOffset specifying the snapshot timestamp, if the share is a snapshot.

Returns

CloudFileShare

A reference to a share.

ListShares(string, ShareListingDetails, FileRequestOptions, OperationContext)

Returns an enumerable collection of shares, which are retrieved lazily, whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual IEnumerable<CloudFileShare> ListShares(string prefix = null, ShareListingDetails detailsIncluded = ShareListingDetails.None, FileRequestOptions options = null, OperationContext operationContext = null)

Parameters

prefix string

The share name prefix.

detailsIncluded ShareListingDetails

A value that indicates whether to return share metadata with the listing.

options FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

IEnumerable<CloudFileShare>

An enumerable collection of shares that are retrieved lazily.

ListSharesSegmented(FileContinuationToken)

Returns a result segment containing a collection of shares.

[DoesServiceRequest]
public virtual ShareResultSegment ListSharesSegmented(FileContinuationToken currentToken)

Parameters

currentToken FileContinuationToken

A FileContinuationToken token returned by a previous listing operation.

Returns

ShareResultSegment

A result segment of shares.

ListSharesSegmented(string, FileContinuationToken)

Returns a result segment containing a collection of shares.

[DoesServiceRequest]
public virtual ShareResultSegment ListSharesSegmented(string prefix, FileContinuationToken currentToken)

Parameters

prefix string

The share name prefix.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

Returns

ShareResultSegment

A result segment of shares.

ListSharesSegmented(string, ShareListingDetails, int?, FileContinuationToken, FileRequestOptions, OperationContext)

Returns a result segment containing a collection of shares whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual ShareResultSegment ListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options = null, OperationContext operationContext = null)

Parameters

prefix string

The share name prefix.

detailsIncluded ShareListingDetails

A value that indicates whether to return share metadata with the listing.

maxResults int?

A non-negative integer value that indicates the maximum number of results to be returned in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

options FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

ShareResultSegment

A result segment of shares.

ListSharesSegmentedAsync(FileContinuationToken)

Returns a task that performs an asynchronous request to return a result segment containing a collection of shares.

[DoesServiceRequest]
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken)

Parameters

currentToken FileContinuationToken

A FileContinuationToken token returned by a previous listing operation.

Returns

Task<ShareResultSegment>

A Task<TResult> object that represents the current operation.

ListSharesSegmentedAsync(FileContinuationToken, CancellationToken)

Returns a task that performs an asynchronous request to return a result segment containing a collection of shares.

[DoesServiceRequest]
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(FileContinuationToken currentToken, CancellationToken cancellationToken)

Parameters

currentToken FileContinuationToken

A FileContinuationToken token returned by a previous listing operation.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<ShareResultSegment>

A Task<TResult> object that represents the current operation.

ListSharesSegmentedAsync(string, FileContinuationToken)

Returns a task that performs an asynchronous request to return a result segment containing a collection of shares whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken)

Parameters

prefix string

The share name prefix.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

Returns

Task<ShareResultSegment>

A Task<TResult> object that represents the current operation.

ListSharesSegmentedAsync(string, FileContinuationToken, CancellationToken)

Returns a task that performs an asynchronous request to return a result segment containing a collection of shares whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken, CancellationToken cancellationToken)

Parameters

prefix string

The share name prefix.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<ShareResultSegment>

A Task<TResult> object that represents the current operation.

ListSharesSegmentedAsync(string, ShareListingDetails, int?, FileContinuationToken, FileRequestOptions, OperationContext)

Returns a task that performs an asynchronous request to return a result segment containing a collection of shares whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext)

Parameters

prefix string

The share name prefix.

detailsIncluded ShareListingDetails

A value that indicates whether to return share metadata with the listing.

maxResults int?

A non-negative integer value that indicates the maximum number of results to be returned in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

options FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

Task<ShareResultSegment>

A Task<TResult> object that represents the current operation.

ListSharesSegmentedAsync(string, ShareListingDetails, int?, FileContinuationToken, FileRequestOptions, OperationContext, CancellationToken)

Returns a task that performs an asynchronous request to return a result segment containing a collection of shares whose names begin with the specified prefix.

[DoesServiceRequest]
public virtual Task<ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int? maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Parameters

prefix string

The share name prefix.

detailsIncluded ShareListingDetails

A value that indicates whether to return share metadata with the listing.

maxResults int?

A non-negative integer value that indicates the maximum number of results to be returned in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.

currentToken FileContinuationToken

A continuation token returned by a previous listing operation.

options FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task<ShareResultSegment>

A Task<TResult> object that represents the current operation.

SetServiceProperties(FileServiceProperties, FileRequestOptions, OperationContext)

Sets service properties for the File service.

[DoesServiceRequest]
public virtual void SetServiceProperties(FileServiceProperties properties, FileRequestOptions requestOptions = null, OperationContext operationContext = null)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

SetServicePropertiesAsync(FileServiceProperties)

Initiates an asynchronous operation that sets service properties for the Blob service.

[DoesServiceRequest]
public virtual Task SetServicePropertiesAsync(FileServiceProperties properties)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

Returns

Task

A Task object that represents the asynchronous operation.

SetServicePropertiesAsync(FileServiceProperties, FileRequestOptions, OperationContext)

Initiates an asynchronous operation that sets service properties for the File service.

[DoesServiceRequest]
public virtual Task SetServicePropertiesAsync(FileServiceProperties properties, FileRequestOptions requestOptions, OperationContext operationContext)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

Returns

Task

A Task object that represents the asynchronous operation.

SetServicePropertiesAsync(FileServiceProperties, FileRequestOptions, OperationContext, CancellationToken)

Initiates an asynchronous operation that sets service properties for the File service.

[DoesServiceRequest]
public virtual Task SetServicePropertiesAsync(FileServiceProperties properties, FileRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

requestOptions FileRequestOptions

A FileRequestOptions object that specifies additional options for the request.

operationContext OperationContext

An OperationContext object that represents the context for the current operation.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task

A Task object that represents the asynchronous operation.

SetServicePropertiesAsync(FileServiceProperties, CancellationToken)

Initiates an asynchronous operation that sets service properties for the Blob service.

[DoesServiceRequest]
public virtual Task SetServicePropertiesAsync(FileServiceProperties properties, CancellationToken cancellationToken)

Parameters

properties FileServiceProperties

A FileServiceProperties object.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for a task to complete.

Returns

Task

A Task object that represents the asynchronous operation.