Class BlobContainerClient | Azure SDK for Net

BlobContainerClient A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime. For more information, . The name of the blob container in the storage account to reference.

Inheritance

BlobContainerClient

Namespace: Azure.Storage.Blobs
Assembly: Azure.Storage.Blobs.dll
Syntax
public class BlobContainerClient

Constructors

BlobContainerClient()

Declaration
protected BlobContainerClient ();

BlobContainerClient(String, String)

Declaration
public BlobContainerClient (string connectionString, string blobContainerName);
Parameters
String connectionString

A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.

For more information, .

String blobContainerName

The name of the blob container in the storage account to reference.

BlobContainerClient(Uri, BlobClientOptions)

Declaration
public BlobContainerClient (Uri blobContainerUri, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
Uri blobContainerUri

A Uri referencing the blob container that includes the name of the account and the name of the container.

BlobClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

BlobContainerClient(String, String, BlobClientOptions)

Declaration
public BlobContainerClient (string connectionString, string blobContainerName, Azure.Storage.Blobs.BlobClientOptions options);
Parameters
String connectionString

A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.

For more information, .

String blobContainerName

The name of the container in the storage account to reference.

BlobClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

BlobContainerClient(Uri, TokenCredential, BlobClientOptions)

Declaration
public BlobContainerClient (Uri blobContainerUri, Azure.Core.TokenCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
Uri blobContainerUri

A Uri referencing the blob container that includes the name of the account and the name of the container.

TokenCredential credential

The token credential used to sign requests.

BlobClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

BlobContainerClient(Uri, StorageSharedKeyCredential, BlobClientOptions)

Declaration
public BlobContainerClient (Uri blobContainerUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
Uri blobContainerUri

A Uri referencing the blob container that includes the name of the account and the name of the container.

StorageSharedKeyCredential credential

The shared key credential used to sign requests.

BlobClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

Fields

LogsBlobContainerName

The Azure Storage name used to identify a storage account's logs container.

Declaration
public static readonly string LogsBlobContainerName;
Field Value

RootBlobContainerName

The Azure Storage name used to identify a storage account's root container.

Declaration
public static readonly string RootBlobContainerName;
Field Value

WebBlobContainerName

The Azure Storage name used to identify a storage account's web content container.

Declaration
public static readonly string WebBlobContainerName;
Field Value

Properties

AccountName

Gets the Storage account name corresponding to the container client.

Declaration
public virtual string AccountName { get; }
Property Value

Name

Gets the name of the container.

Declaration
public virtual string Name { get; }
Property Value

Uri

Gets the container's primary Uri endpoint.

Declaration
public virtual Uri Uri { get; }
Property Value

Methods

Create(PublicAccessType, IDictionary<String,String>, CancellationToken)

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> Create (Azure.Storage.Blobs.Models.PublicAccessType publicAccessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
PublicAccessType publicAccessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

IDictionary<String,String> metadata

Optional custom metadata to set for this container.

CancellationToken cancellationToken

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

Returns

CreateAsync(PublicAccessType, IDictionary<String,String>, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>> CreateAsync (Azure.Storage.Blobs.Models.PublicAccessType publicAccessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
PublicAccessType publicAccessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

IDictionary<String,String> metadata

Optional custom metadata to set for this container.

CancellationToken cancellationToken

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

Returns

CreateIfNotExists(PublicAccessType, IDictionary<String,String>, CancellationToken)

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> CreateIfNotExists (Azure.Storage.Blobs.Models.PublicAccessType publicAccessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
PublicAccessType publicAccessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

IDictionary<String,String> metadata

Optional custom metadata to set for this container.

CancellationToken cancellationToken

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

Returns

CreateIfNotExistsAsync(PublicAccessType, IDictionary<String,String>, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>> CreateIfNotExistsAsync (Azure.Storage.Blobs.Models.PublicAccessType publicAccessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
PublicAccessType publicAccessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

IDictionary<String,String> metadata

Optional custom metadata to set for this container.

CancellationToken cancellationToken

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

Returns

Delete(BlobRequestConditions, CancellationToken)

Declaration
public virtual Azure.Response Delete (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteAsync(BlobRequestConditions, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteBlob(String, DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)

Declaration
[Azure.Core.ForwardsClientCalls] public virtual Azure.Response DeleteBlob (string blobName, Azure.Storage.Blobs.Models.DeleteSnapshotsOption snapshotsOption = Azure.Storage.Blobs.Models.DeleteSnapshotsOption.None, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteBlobAsync(String, DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)

Declaration
[Azure.Core.ForwardsClientCalls] [System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response> DeleteBlobAsync (string blobName, Azure.Storage.Blobs.Models.DeleteSnapshotsOption snapshotsOption = Azure.Storage.Blobs.Models.DeleteSnapshotsOption.None, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteBlobIfExists(String, DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)

Declaration
[Azure.Core.ForwardsClientCalls] public virtual Azure.Response<bool> DeleteBlobIfExists (string blobName, Azure.Storage.Blobs.Models.DeleteSnapshotsOption snapshotsOption = Azure.Storage.Blobs.Models.DeleteSnapshotsOption.None, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteBlobIfExistsAsync(String, DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)

Declaration
[Azure.Core.ForwardsClientCalls] [System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteBlobIfExistsAsync (string blobName, Azure.Storage.Blobs.Models.DeleteSnapshotsOption snapshotsOption = Azure.Storage.Blobs.Models.DeleteSnapshotsOption.None, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteIfExists(BlobRequestConditions, CancellationToken)

Declaration
public virtual Azure.Response<bool> DeleteIfExists (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteIfExistsAsync(BlobRequestConditions, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteIfExistsAsync (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetAccessPolicy(BlobRequestConditions, CancellationToken)

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContainerAccessPolicy> GetAccessPolicy (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetAccessPolicyAsync(BlobRequestConditions, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerAccessPolicy>> GetAccessPolicyAsync (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetBlobClient(String)

Declaration
public virtual Azure.Storage.Blobs.BlobClient GetBlobClient (string blobName);
Parameters
String blobName

The name of the blob.

Returns

GetBlobs(BlobTraits, BlobStates, String, CancellationToken)

The GetBlobs(BlobTraits, BlobStates, String, CancellationToken) operation returns an async sequence of blobs in this container. Enumerating the blobs may make multiple requests to the service while fetching all the values. Blobs are ordered lexicographically by name.

For more information, see .

Declaration
public virtual Azure.Pageable<Azure.Storage.Blobs.Models.BlobItem> GetBlobs (Azure.Storage.Blobs.Models.BlobTraits traits = Azure.Storage.Blobs.Models.BlobTraits.None, Azure.Storage.Blobs.Models.BlobStates states = Azure.Storage.Blobs.Models.BlobStates.None, string prefix = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
BlobTraits traits

Specifies trait options for shaping the blobs.

BlobStates states

Specifies state options for filtering the blobs.

String prefix

Specifies a string that filters the results to return only blobs whose name begins with the specified prefix.

CancellationToken cancellationToken

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

Returns

GetBlobsAsync(BlobTraits, BlobStates, String, CancellationToken)

Declaration
public virtual Azure.AsyncPageable<Azure.Storage.Blobs.Models.BlobItem> GetBlobsAsync (Azure.Storage.Blobs.Models.BlobTraits traits = Azure.Storage.Blobs.Models.BlobTraits.None, Azure.Storage.Blobs.Models.BlobStates states = Azure.Storage.Blobs.Models.BlobStates.None, string prefix = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
BlobTraits traits

Specifies trait options for shaping the blobs.

BlobStates states

Specifies state options for filtering the blobs.

String prefix

Specifies a string that filters the results to return only blobs whose name begins with the specified prefix.

CancellationToken cancellationToken

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

Returns

GetBlobsByHierarchy(BlobTraits, BlobStates, String, String, CancellationToken)

The GetBlobsByHierarchy(BlobTraits, BlobStates, String, String, CancellationToken) operation returns an async collection of blobs in this container. Enumerating the blobs may make multiple requests to the service while fetching all the values. Blobs are ordered lexicographically by name. A delimiter can be used to traverse a virtual hierarchy of blobs as though it were a file system.

For more information, see .

Declaration
public virtual Azure.Pageable<Azure.Storage.Blobs.Models.BlobHierarchyItem> GetBlobsByHierarchy (Azure.Storage.Blobs.Models.BlobTraits traits = Azure.Storage.Blobs.Models.BlobTraits.None, Azure.Storage.Blobs.Models.BlobStates states = Azure.Storage.Blobs.Models.BlobStates.None, string delimiter = null, string prefix = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
BlobTraits traits

Specifies trait options for shaping the blobs.

BlobStates states

Specifies state options for filtering the blobs.

String delimiter

A delimiter that can be used to traverse a virtual hierarchy of blobs as though it were a file system. The delimiter may be a single character or a string. Prefix will be returned in place of all blobs whose names begin with the same substring up to the appearance of the delimiter character. The value of a prefix is substring+delimiter, where substring is the common substring that begins one or more blob names, and delimiter is the value of delimiter. You can use the value of prefix to make a subsequent call to list the blobs that begin with this prefix, by specifying the value of the prefix for the prefix.

Note that each BlobPrefix element returned counts toward the maximum result, just as each Blob element does.

String prefix

Specifies a string that filters the results to return only blobs whose name begins with the specified prefix.

CancellationToken cancellationToken

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

Returns

GetBlobsByHierarchyAsync(BlobTraits, BlobStates, String, String, CancellationToken)

The GetBlobsByHierarchyAsync(BlobTraits, BlobStates, String, String, CancellationToken) operation returns an async collection of blobs in this container. Enumerating the blobs may make multiple requests to the service while fetching all the values. Blobs are ordered lexicographically by name. A delimiter can be used to traverse a virtual hierarchy of blobs as though it were a file system.

For more information, see .

Declaration
public virtual Azure.AsyncPageable<Azure.Storage.Blobs.Models.BlobHierarchyItem> GetBlobsByHierarchyAsync (Azure.Storage.Blobs.Models.BlobTraits traits = Azure.Storage.Blobs.Models.BlobTraits.None, Azure.Storage.Blobs.Models.BlobStates states = Azure.Storage.Blobs.Models.BlobStates.None, string delimiter = null, string prefix = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
BlobTraits traits

Specifies trait options for shaping the blobs.

BlobStates states

Specifies state options for filtering the blobs.

String delimiter

A delimiter that can be used to traverse a virtual hierarchy of blobs as though it were a file system. The delimiter may be a single character or a string. Prefix will be returned in place of all blobs whose names begin with the same substring up to the appearance of the delimiter character. The value of a prefix is substring+delimiter, where substring is the common substring that begins one or more blob names, and delimiter is the value of delimiter. You can use the value of prefix to make a subsequent call to list the blobs that begin with this prefix, by specifying the value of the prefix for the prefix.

Note that each BlobPrefix element returned counts toward the maximum result, just as each Blob element does.

String prefix

Specifies a string that filters the results to return only blobs whose name begins with the specified prefix.

CancellationToken cancellationToken

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

Returns

GetProperties(BlobRequestConditions, CancellationToken)

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContainerProperties> GetProperties (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetPropertiesAsync(BlobRequestConditions, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerProperties>> GetPropertiesAsync (Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SetAccessPolicy(PublicAccessType, IEnumerable<BlobSignedIdentifier>, BlobRequestConditions, CancellationToken)

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> SetAccessPolicy (Azure.Storage.Blobs.Models.PublicAccessType accessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobSignedIdentifier> permissions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
PublicAccessType accessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

IEnumerable<BlobSignedIdentifier> permissions

Stored access policies that you can use to provide fine grained control over container permissions.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on setting this blob container's access policy.

CancellationToken cancellationToken

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

Returns

SetAccessPolicyAsync(PublicAccessType, IEnumerable<BlobSignedIdentifier>, BlobRequestConditions, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>> SetAccessPolicyAsync (Azure.Storage.Blobs.Models.PublicAccessType accessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IEnumerable<Azure.Storage.Blobs.Models.BlobSignedIdentifier> permissions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
PublicAccessType accessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

IEnumerable<BlobSignedIdentifier> permissions

Stored access policies that you can use to provide fine grained control over container permissions.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on setting this blob container's access policy.

CancellationToken cancellationToken

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

Returns

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

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

UploadBlob(String, Stream, CancellationToken)

Declaration
[Azure.Core.ForwardsClientCalls] public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> UploadBlob (string blobName, System.IO.Stream content, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

UploadBlobAsync(String, Stream, CancellationToken)

Declaration
[Azure.Core.ForwardsClientCalls] [System.Diagnostics.DebuggerStepThrough] public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> UploadBlobAsync (string blobName, System.IO.Stream content, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

Extension Methods

ncG1vNJzZmiZqqq%2Fpr%2FDpJuom6Njr627wWeaqKqVY8SqusOorqxmnprBcHDWnplonJ%2Bpu6bAjnqxrqqVY6C1u9Ganp5mcqG8o7%2BOamlnaF5lfKK8yGh4s62imnuUwM6rmKCdXne5sK7SaHizraKae5TAzquYoJ1ed7mwrtJneaWnkni8r8DAoqWeqnOhtqa602efraWc

 Share!