Show / Hide Table of Contents

Class BlockBlobClient

The BlockBlobClient allows you to manipulate Azure Storage block blobs.

Block blobs let you upload large blobs efficiently. Block blobs are comprised of blocks, each of which is identified by a block ID. You create or modify a block blob by writing a set of blocks and committing them by their block IDs. Each block can be a different size, up to a maximum of 4,000 MB (100 MB for requests using REST versions before 2019-12-12 and 4 MB for requests using REST versions before 2016-05-31), and a block blob can include up to 50,000 blocks. The maximum size of a block blob is therefore approximately 190.73 TiB (4,000 MB X 50,000 blocks). If you are writing a block blob that is no more than 5,000 MB in size, you can upload it in its entirety with a single write operation; see UploadAsync(Stream, BlobUploadOptions, CancellationToken).

When you upload a block to a blob in your storage account, it is associated with the specified block blob, but it does not become part of the blob until you commit a list of blocks that includes the new block's ID. New blocks remain in an uncommitted state until they are specifically committed or discarded. Writing a block does not update the last modified time of an existing blob.

Block blobs include features that help you manage large files over networks. With a block blob, you can upload multiple blocks in parallel to decrease upload time. Each block can include an MD5 hash to verify the transfer, so you can track upload progress and re-send blocks as needed.You can upload blocks in any order, and determine their sequence in the final block list commitment step. You can also upload a new block to replace an existing uncommitted block of the same block ID. You have one week to commit blocks to a blob before they are discarded. All uncommitted blocks are also discarded when a block list commitment operation occurs but does not include them.

You can modify an existing block blob by inserting, replacing, or deleting existing blocks. After uploading the block or blocks that have changed, you can commit a new version of the blob by committing the new blocks with the existing blocks you want to keep using a single commit operation. To insert the same range of bytes in two different locations of the committed blob, you can commit the same block in two places within the same commit operation.For any commit operation, if any block is not found, the entire commitment operation fails with an error, and the blob is not modified. Any block commitment overwrites the blob’s existing properties and metadata, and discards all uncommitted blocks.

Block IDs are strings of equal length within a blob. Block client code usually uses base-64 encoding to normalize strings into equal lengths. When using base-64 encoding, the pre-encoded string must be 64 bytes or less. Block ID values can be duplicated in different blobs. A blob can have up to 100,000 uncommitted blocks, with a max total size of appoximately 381.46 TiB (4,000 MB x 100,000 blocks)

If you write a block for a blob that does not exist, a new block blob is created, with a length of zero bytes. This blob will appear in blob lists that include uncommitted blobs. If you don’t commit any block to this blob, it and its uncommitted blocks will be discarded one week after the last successful block upload. All uncommitted blocks are also discarded when a new blob of the same name is created using a single step(rather than the two-step block upload-then-commit process).

Inheritance
System.Object
BlobBaseClient
BlockBlobClient
Inherited Members
BlobBaseClient.AbortCopyFromUri(String, BlobRequestConditions, CancellationToken)
BlobBaseClient.AbortCopyFromUriAsync(String, BlobRequestConditions, CancellationToken)
BlobBaseClient.AccountName
BlobBaseClient.BlobContainerName
BlobBaseClient.CanGenerateSasUri
BlobBaseClient.CreateSnapshot(IDictionary<String,String>, BlobRequestConditions, CancellationToken)
BlobBaseClient.CreateSnapshotAsync(IDictionary<String,String>, BlobRequestConditions, CancellationToken)
BlobBaseClient.Delete(DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)
BlobBaseClient.DeleteAsync(DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)
BlobBaseClient.DeleteIfExists(DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)
BlobBaseClient.DeleteIfExistsAsync(DeleteSnapshotsOption, BlobRequestConditions, CancellationToken)
BlobBaseClient.DeleteImmutabilityPolicy(CancellationToken)
BlobBaseClient.DeleteImmutabilityPolicyAsync(CancellationToken)
BlobBaseClient.Download()
BlobBaseClient.Download(HttpRange, BlobRequestConditions, Boolean, CancellationToken)
BlobBaseClient.Download(CancellationToken)
BlobBaseClient.DownloadAsync()
BlobBaseClient.DownloadAsync(HttpRange, BlobRequestConditions, Boolean, CancellationToken)
BlobBaseClient.DownloadAsync(CancellationToken)
BlobBaseClient.DownloadContent()
BlobBaseClient.DownloadContent(BlobDownloadOptions, CancellationToken)
BlobBaseClient.DownloadContent(BlobRequestConditions, IProgress<Int64>, HttpRange, CancellationToken)
BlobBaseClient.DownloadContent(BlobRequestConditions, CancellationToken)
BlobBaseClient.DownloadContent(CancellationToken)
BlobBaseClient.DownloadContentAsync()
BlobBaseClient.DownloadContentAsync(BlobDownloadOptions, CancellationToken)
BlobBaseClient.DownloadContentAsync(BlobRequestConditions, IProgress<Int64>, HttpRange, CancellationToken)
BlobBaseClient.DownloadContentAsync(BlobRequestConditions, CancellationToken)
BlobBaseClient.DownloadContentAsync(CancellationToken)
BlobBaseClient.DownloadStreaming(HttpRange, BlobRequestConditions, Boolean, IProgress<Int64>, CancellationToken)
BlobBaseClient.DownloadStreaming(HttpRange, BlobRequestConditions, Boolean, CancellationToken)
BlobBaseClient.DownloadStreaming(BlobDownloadOptions, CancellationToken)
BlobBaseClient.DownloadStreamingAsync(HttpRange, BlobRequestConditions, Boolean, IProgress<Int64>, CancellationToken)
BlobBaseClient.DownloadStreamingAsync(HttpRange, BlobRequestConditions, Boolean, CancellationToken)
BlobBaseClient.DownloadStreamingAsync(BlobDownloadOptions, CancellationToken)
BlobBaseClient.DownloadTo(Stream)
BlobBaseClient.DownloadTo(Stream, BlobDownloadToOptions, CancellationToken)
BlobBaseClient.DownloadTo(Stream, BlobRequestConditions, StorageTransferOptions, CancellationToken)
BlobBaseClient.DownloadTo(Stream, CancellationToken)
BlobBaseClient.DownloadTo(String)
BlobBaseClient.DownloadTo(String, BlobDownloadToOptions, CancellationToken)
BlobBaseClient.DownloadTo(String, BlobRequestConditions, StorageTransferOptions, CancellationToken)
BlobBaseClient.DownloadTo(String, CancellationToken)
BlobBaseClient.DownloadToAsync(Stream)
BlobBaseClient.DownloadToAsync(Stream, BlobDownloadToOptions, CancellationToken)
BlobBaseClient.DownloadToAsync(Stream, BlobRequestConditions, StorageTransferOptions, CancellationToken)
BlobBaseClient.DownloadToAsync(Stream, CancellationToken)
BlobBaseClient.DownloadToAsync(String)
BlobBaseClient.DownloadToAsync(String, BlobDownloadToOptions, CancellationToken)
BlobBaseClient.DownloadToAsync(String, BlobRequestConditions, StorageTransferOptions, CancellationToken)
BlobBaseClient.DownloadToAsync(String, CancellationToken)
BlobBaseClient.Exists(CancellationToken)
BlobBaseClient.ExistsAsync(CancellationToken)
BlobBaseClient.GenerateSasUri(BlobSasBuilder)
BlobBaseClient.GenerateSasUri(BlobSasBuilder, String)
BlobBaseClient.GenerateSasUri(BlobSasPermissions, DateTimeOffset)
BlobBaseClient.GenerateSasUri(BlobSasPermissions, DateTimeOffset, String)
BlobBaseClient.GenerateUserDelegationSasUri(BlobSasBuilder, UserDelegationKey)
BlobBaseClient.GenerateUserDelegationSasUri(BlobSasBuilder, UserDelegationKey, String)
BlobBaseClient.GenerateUserDelegationSasUri(BlobSasPermissions, DateTimeOffset, UserDelegationKey)
BlobBaseClient.GenerateUserDelegationSasUri(BlobSasPermissions, DateTimeOffset, UserDelegationKey, String)
BlobBaseClient.GetAccountInfo(CancellationToken)
BlobBaseClient.GetAccountInfoAsync(CancellationToken)
BlobBaseClient.GetBlobLeaseClientCore(String)
BlobBaseClient.GetParentBlobContainerClientCore()
BlobBaseClient.GetProperties(BlobRequestConditions, CancellationToken)
BlobBaseClient.GetPropertiesAsync(BlobRequestConditions, CancellationToken)
BlobBaseClient.GetTags(BlobRequestConditions, CancellationToken)
BlobBaseClient.GetTagsAsync(BlobRequestConditions, CancellationToken)
BlobBaseClient.Name
BlobBaseClient.OpenRead(BlobOpenReadOptions, CancellationToken)
BlobBaseClient.OpenRead(Boolean, Int64, Nullable<Int32>, CancellationToken)
BlobBaseClient.OpenRead(Int64, Nullable<Int32>, BlobRequestConditions, CancellationToken)
BlobBaseClient.OpenReadAsync(BlobOpenReadOptions, CancellationToken)
BlobBaseClient.OpenReadAsync(Boolean, Int64, Nullable<Int32>, CancellationToken)
BlobBaseClient.OpenReadAsync(Int64, Nullable<Int32>, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetAccessTier(AccessTier, BlobRequestConditions, Nullable<RehydratePriority>, CancellationToken)
BlobBaseClient.SetAccessTierAsync(AccessTier, BlobRequestConditions, Nullable<RehydratePriority>, CancellationToken)
BlobBaseClient.SetHttpHeaders(BlobHttpHeaders, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetHttpHeadersAsync(BlobHttpHeaders, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetImmutabilityPolicy(BlobImmutabilityPolicy, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetImmutabilityPolicyAsync(BlobImmutabilityPolicy, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetLegalHold(Boolean, CancellationToken)
BlobBaseClient.SetLegalHoldAsync(Boolean, CancellationToken)
BlobBaseClient.SetMetadata(IDictionary<String,String>, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetMetadataAsync(IDictionary<String,String>, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetTags(IDictionary<String,String>, BlobRequestConditions, CancellationToken)
BlobBaseClient.SetTagsAsync(IDictionary<String,String>, BlobRequestConditions, CancellationToken)
BlobBaseClient.StartCopyFromUri(Uri, BlobCopyFromUriOptions, CancellationToken)
BlobBaseClient.StartCopyFromUri(Uri, IDictionary<String,String>, Nullable<AccessTier>, BlobRequestConditions, BlobRequestConditions, Nullable<RehydratePriority>, CancellationToken)
BlobBaseClient.StartCopyFromUriAsync(Uri, BlobCopyFromUriOptions, CancellationToken)
BlobBaseClient.StartCopyFromUriAsync(Uri, IDictionary<String,String>, Nullable<AccessTier>, BlobRequestConditions, BlobRequestConditions, Nullable<RehydratePriority>, CancellationToken)
BlobBaseClient.SyncCopyFromUri(Uri, BlobCopyFromUriOptions, CancellationToken)
BlobBaseClient.SyncCopyFromUriAsync(Uri, BlobCopyFromUriOptions, CancellationToken)
BlobBaseClient.Undelete(CancellationToken)
BlobBaseClient.UndeleteAsync(CancellationToken)
BlobBaseClient.Uri
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Storage.Blobs.dll
Syntax
public class BlockBlobClient : Azure.Storage.Blobs.Specialized.BlobBaseClient

Constructors

BlockBlobClient()

Initializes a new instance of the BlockBlobClient class for mocking.

Declaration
protected BlockBlobClient ();

BlockBlobClient(Uri, BlobClientOptions)

Initializes a new instance of the BlockBlobClient class.

Declaration
public BlockBlobClient (Uri blobUri, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
System.Uri blobUri

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

BlobClientOptions options

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

BlockBlobClient(String, String, String)

Initializes a new instance of the BlockBlobClient class.

Declaration
public BlockBlobClient (string connectionString, string containerName, string blobName);
Parameters
System.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, Configure Azure Storage connection strings

System.String containerName

The name of the container containing this block blob.

System.String blobName

The name of this block blob.

BlockBlobClient(Uri, AzureSasCredential, BlobClientOptions)

Initializes a new instance of the BlockBlobClient class.

Declaration
public BlockBlobClient (Uri blobUri, Azure.AzureSasCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
System.Uri blobUri

A System.Uri referencing the blob that includes the name of the account, the name of the container, and the name of the blob. Must not contain shared access signature, which should be passed in the second parameter.

Azure.AzureSasCredential credential

The shared access signature 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.

Remarks

This constructor should only be used when shared access signature needs to be updated during lifespan of this client.

BlockBlobClient(Uri, TokenCredential, BlobClientOptions)

Initializes a new instance of the BlockBlobClient class.

Declaration
public BlockBlobClient (Uri blobUri, Azure.Core.TokenCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
System.Uri blobUri

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

Azure.Core.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.

BlockBlobClient(Uri, StorageSharedKeyCredential, BlobClientOptions)

Initializes a new instance of the BlockBlobClient class.

Declaration
public BlockBlobClient (Uri blobUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Blobs.BlobClientOptions options = null);
Parameters
System.Uri blobUri

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

Azure.Storage.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.

BlockBlobClient(String, String, String, BlobClientOptions)

Initializes a new instance of the BlockBlobClient class.

Declaration
public BlockBlobClient (string connectionString, string blobContainerName, string blobName, Azure.Storage.Blobs.BlobClientOptions options);
Parameters
System.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, Configure Azure Storage connection strings

System.String blobContainerName

The name of the container containing this block blob.

System.String blobName

The name of this block blob.

BlobClientOptions options

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

Properties

BlockBlobMaxBlocks

Gets the maximum number of blocks allowed in a block blob.

Declaration
public virtual int BlockBlobMaxBlocks { get; }
Property Value
System.Int32

BlockBlobMaxStageBlockBytes

Gets the maximum number of bytes that can be sent in a call to StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken). Supported value is now larger than System.Int32.MaxValue; please use BlockBlobMaxStageBlockLongBytes.

Declaration
[System.ComponentModel.EditorBrowsable]
public virtual int BlockBlobMaxStageBlockBytes { get; }
Property Value
System.Int32

BlockBlobMaxStageBlockLongBytes

Gets the maximum number of bytes that can be sent in a call to StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken).

Declaration
public virtual long BlockBlobMaxStageBlockLongBytes { get; }
Property Value
System.Int64

BlockBlobMaxUploadBlobBytes

Gets the maximum number of bytes that can be sent in a call to UploadAsync(Stream, BlobUploadOptions, CancellationToken). Supported value is now larger than System.Int32.MaxValue; please use BlockBlobMaxUploadBlobLongBytes.

Declaration
[System.ComponentModel.EditorBrowsable]
public virtual int BlockBlobMaxUploadBlobBytes { get; }
Property Value
System.Int32

BlockBlobMaxUploadBlobLongBytes

Gets the maximum number of bytes that can be sent in a call to UploadAsync(Stream, BlobUploadOptions, CancellationToken).

Declaration
public virtual long BlockBlobMaxUploadBlobLongBytes { get; }
Property Value
System.Int64

Methods

CommitBlockList(IEnumerable<String>, CommitBlockListOptions, CancellationToken)

The CommitBlockList(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) operation. You can call CommitBlockList(IEnumerable<String>, CommitBlockListOptions, CancellationToken) to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. Any blocks not specified in the block list are permanently deleted.

Note: Uncommitted blocks will expire and be permanently deleted after 7 days. Blocks that are committed to a blob do not expire.

For more information, see Put Block List.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> CommitBlockList (System.Collections.Generic.IEnumerable<string> base64BlockIds, Azure.Storage.Blobs.Models.CommitBlockListOptions options, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Collections.Generic.IEnumerable<System.String> base64BlockIds

Specify the Uncommitted Base64 encoded block IDs to indicate that the blob service should search only the uncommitted block list for the named blocks. If the block is not found in the uncommitted block list, it will not be written as part of the blob, and a Azure.RequestFailedException will be thrown.

CommitBlockListOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobContentInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

CommitBlockList(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken)

The CommitBlockList(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) operation. You can call CommitBlockList(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. Any blocks not specified in the block list are permanently deleted.

Note: Uncommitted blocks will expire and be permanently deleted after 7 days. Blocks that are committed to a blob do not expire.

For more information, see Put Block List.

Declaration
[System.ComponentModel.EditorBrowsable]
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> CommitBlockList (System.Collections.Generic.IEnumerable<string> base64BlockIds, Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string,string> metadata = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, Nullable<Azure.Storage.Blobs.Models.AccessTier> accessTier = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Collections.Generic.IEnumerable<System.String> base64BlockIds

Specify the Uncommitted Base64 encoded block IDs to indicate that the blob service should search only the uncommitted block list for the named blocks. If the block is not found in the uncommitted block list, it will not be written as part of the blob, and a Azure.RequestFailedException will be thrown.

BlobHttpHeaders httpHeaders

Optional standard HTTP header properties that can be set for the block blob.

System.Collections.Generic.IDictionary<System.String,System.String> metadata

Optional custom metadata to set for this block blob.

BlobRequestConditions conditions

Optional BlockBlobClient to add conditions on committing this block list.

System.Nullable<AccessTier> accessTier

Optional AccessTier Indicates the tier to be set on the blob.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobContentInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken)

The CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) operation. You can call CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken) to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. Any blocks not specified in the block list are permanently deleted.

Note: Uncommitted blocks will expire and be permanently deleted after 7 days. Blocks that are committed to a blob do not expire.

For more information, see Put Block List.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> CommitBlockListAsync (System.Collections.Generic.IEnumerable<string> base64BlockIds, Azure.Storage.Blobs.Models.CommitBlockListOptions options, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Collections.Generic.IEnumerable<System.String> base64BlockIds

Specify the Uncommitted Base64 encoded block IDs to indicate that the blob service should search only the uncommitted block list for the named blocks. If the block is not found in the uncommitted block list, it will not be written as part of the blob, and a Azure.RequestFailedException will be thrown.

CommitBlockListOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobContentInfo>>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

CommitBlockListAsync(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken)

The CommitBlockListAsync(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) operation writes a blob bys pecifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) operation. You can call CommitBlockListAsync(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. Any blocks not specified in the block list are permanently deleted.

Note: Uncommitted blocks will expire and be permanently deleted after 7 days. Blocks that are committed to a blob do not expire.

For more information, see Put Block List.

Declaration
[System.ComponentModel.EditorBrowsable]
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> CommitBlockListAsync (System.Collections.Generic.IEnumerable<string> base64BlockIds, Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string,string> metadata = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, Nullable<Azure.Storage.Blobs.Models.AccessTier> accessTier = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Collections.Generic.IEnumerable<System.String> base64BlockIds

Specify the Uncommitted Base64 encoded block IDs to indicate that the blob service should search only the uncommitted block list for the named blocks. If the block is not found in the uncommitted block list, it will not be written as part of the blob, and a Azure.RequestFailedException will be thrown.

BlobHttpHeaders httpHeaders

Optional standard HTTP header properties that can be set for the block blob.

System.Collections.Generic.IDictionary<System.String,System.String> metadata

Optional custom metadata to set for this block blob.

BlobRequestConditions conditions

Optional BlockBlobClient to add conditions on committing this block list.

System.Nullable<AccessTier> accessTier

Optional AccessTier Indicates the tier to be set on the blob.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobContentInfo>>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

CreateClient(Uri, BlobClientOptions, HttpPipeline)

Initializes a new instance of the BlockBlobClient class.

Declaration
protected static Azure.Storage.Blobs.Specialized.BlockBlobClient CreateClient (Uri blobUri, Azure.Storage.Blobs.BlobClientOptions options, Azure.Core.Pipeline.HttpPipeline pipeline);
Parameters
System.Uri blobUri

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

BlobClientOptions options

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

Azure.Core.Pipeline.HttpPipeline pipeline

The transport pipeline used to send every request.

Returns
BlockBlobClient

New instanc of the BlockBlobClient class.

GetBlockList(BlockListTypes, String, BlobRequestConditions, CancellationToken)

The GetBlockList(BlockListTypes, String, BlobRequestConditions, CancellationToken) operation operation retrieves the list of blocks that have been uploaded as part of a block blob. There are two block lists maintained for a blob. The Committed Block list has blocks that have been successfully committed to a given blob with CommitBlockList(IEnumerable<String>, CommitBlockListOptions, CancellationToken). The Uncommitted Block list has blocks that have been uploaded for a blob using StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken), but that have not yet been committed. These blocks are stored in Azure in association with a blob, but do not yet form part of the blob.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockList> GetBlockList (Azure.Storage.Blobs.Models.BlockListTypes blockListTypes = Azure.Storage.Blobs.Models.BlockListTypes.All, string snapshot = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
BlockListTypes blockListTypes

Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. If you omit this parameter, Get Block List returns the list of committed blocks.

System.String snapshot

Optionally specifies the blob snapshot to retrieve the block list from. For more information on working with blob snapshots, see Create a snapshot of a blob.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on retrieving the block list.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlockList>

A Azure.Response describing requested block list.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

GetBlockListAsync(BlockListTypes, String, BlobRequestConditions, CancellationToken)

The GetBlockListAsync(BlockListTypes, String, BlobRequestConditions, CancellationToken) operation operation retrieves the list of blocks that have been uploaded as part of a block blob. There are two block lists maintained for a blob. The Committed Block list has blocks that have been successfully committed to a given blob with CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken). The Uncommitted Block list has blocks that have been uploaded for a blob using StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken), but that have not yet been committed. These blocks are stored in Azure in association with a blob, but do not yet form part of the blob.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockList>> GetBlockListAsync (Azure.Storage.Blobs.Models.BlockListTypes blockListTypes = Azure.Storage.Blobs.Models.BlockListTypes.All, string snapshot = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
BlockListTypes blockListTypes

Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. If you omit this parameter, Get Block List returns the list of committed blocks.

System.String snapshot

Optionally specifies the blob snapshot to retrieve the block list from. For more information on working with blob snapshots, see Create a snapshot of a blob.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on retrieving the block list.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlockList>>

A Azure.Response describing requested block list.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

OpenWrite(Boolean, BlockBlobOpenWriteOptions, CancellationToken)

Opens a stream for writing to the blob.

Declaration
public virtual System.IO.Stream OpenWrite (bool overwrite, Azure.Storage.Blobs.Models.BlockBlobOpenWriteOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Boolean overwrite

Whether an existing blob should be deleted and recreated.

BlockBlobOpenWriteOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.IO.Stream

A stream to write to the Append Blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

OpenWriteAsync(Boolean, BlockBlobOpenWriteOptions, CancellationToken)

Opens a stream for writing to the blob. If the blob exists, it will be overwritten.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<System.IO.Stream> OpenWriteAsync (bool overwrite, Azure.Storage.Blobs.Models.BlockBlobOpenWriteOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Boolean overwrite

Whether an existing blob should be deleted and recreated.

BlockBlobOpenWriteOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<System.IO.Stream>

A stream to write to the Append Blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

Query(String, BlobQueryOptions, CancellationToken)

The Query(String, BlobQueryOptions, CancellationToken) API returns the result of a query against the blob.

For more information, see Query Blob Contents.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobDownloadInfo> Query (string querySqlExpression, Azure.Storage.Blobs.Models.BlobQueryOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.String querySqlExpression

The query.

BlobQueryOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobDownloadInfo>

A Azure.Response.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

QueryAsync(String, BlobQueryOptions, CancellationToken)

The QueryAsync(String, BlobQueryOptions, CancellationToken) API returns the result of a query against the blob.

For more information, see Query Blob Contents.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobDownloadInfo>> QueryAsync (string querySqlExpression, Azure.Storage.Blobs.Models.BlobQueryOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.String querySqlExpression

The query.

BlobQueryOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobDownloadInfo>>

A Azure.Response.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlock(String, Stream, BlockBlobStageBlockOptions, CancellationToken)

The StageBlock(String, Stream, BlockBlobStageBlockOptions, CancellationToken) operation creates a new block as part of a block blob's "staging area" to be eventually committed via the CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operation.

For more information, see Put Block.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlock (string base64BlockId, System.IO.Stream content, Azure.Storage.Blobs.Models.BlockBlobStageBlockOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size.

For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

System.IO.Stream content

A System.IO.Stream containing the content to upload. The System.IO.Stream must be seekable.

BlockBlobStageBlockOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlockInfo>

A Azure.Response describing the state of the updated block.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken)

The StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) operation creates a new block as part of a block blob's "staging area" to be eventually committed via the CommitBlockList(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operation.

For more information, see Put Block.

Declaration
[System.ComponentModel.EditorBrowsable]
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlock (string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, IProgress<long> progressHandler, System.Threading.CancellationToken cancellationToken);
Parameters
System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size.

For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

System.IO.Stream content

A System.IO.Stream containing the content to upload. The System.IO.Stream must be seekable.

System.Byte[] transactionalContentHash

An optional MD5 hash of the block content. This hash is used to verify the integrity of the block during transport. When this value is specified, the storage service compares the hash of the content that has arrived with this value. Note that this MD5 hash is not stored with the blob. If the two hashes do not match, the operation will throw a Azure.RequestFailedException.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on the upload of this block.

System.IProgress<System.Int64> progressHandler

Optional System.IProgress to provide progress updates about data transfers.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlockInfo>

A Azure.Response describing the state of the updated block.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlockAsync(String, Stream, BlockBlobStageBlockOptions, CancellationToken)

The StageBlockAsync(String, Stream, BlockBlobStageBlockOptions, CancellationToken) operation creates a new block as part of a block blob's "staging area" to be eventually committed via the CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operation.

For more information, see Put Block.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockAsync (string base64BlockId, System.IO.Stream content, Azure.Storage.Blobs.Models.BlockBlobStageBlockOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size.

For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

System.IO.Stream content

A System.IO.Stream containing the content to upload. The System.IO.Stream must be seekable.

BlockBlobStageBlockOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlockInfo>>

A Azure.Response describing the state of the updated block.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken)

The StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) operation creates a new block as part of a block blob's "staging area" to be eventually committed via the CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operation.

For more information, see Put Block.

Declaration
[System.ComponentModel.EditorBrowsable]
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockAsync (string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, IProgress<long> progressHandler, System.Threading.CancellationToken cancellationToken);
Parameters
System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size.

For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

System.IO.Stream content

A System.IO.Stream containing the content to upload. The System.IO.Stream must be seekable.

System.Byte[] transactionalContentHash

An optional MD5 hash of the block content. This hash is used to verify the integrity of the block during transport. When this value is specified, the storage service compares the hash of the content that has arrived with this value. Note that this MD5 hash is not stored with the blob. If the two hashes do not match, the operation will throw a Azure.RequestFailedException.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on the upload of this block.

System.IProgress<System.Int64> progressHandler

Optional System.IProgress to provide progress updates about data transfers.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlockInfo>>

A Azure.Response describing the state of the updated block.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlockFromUri(Uri, String, StageBlockFromUriOptions, CancellationToken)

The StageBlockFromUri(Uri, String, StageBlockFromUriOptions, CancellationToken) operation creates a new block to be committed as part of a blob where the contents are read from the sourceUri.

For more information, see Put Block From URL.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlockFromUri (Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Uri sourceUri

Specifies the System.Uri of the source blob. The value may be a URL of up to 2 KB in length that specifies a blob. The source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.

System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the base64BlockId parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

StageBlockFromUriOptions options

Optional parameters. StageBlockFromUriOptions.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlockInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlockFromUri(Uri, String, HttpRange, Byte[], RequestConditions, BlobRequestConditions, CancellationToken)

The StageBlockFromUri(Uri, String, HttpRange, Byte[], RequestConditions, BlobRequestConditions, CancellationToken) operation creates a new block to be committed as part of a blob where the contents are read from the sourceUri.

For more information, see Put Block From URL.

Declaration
[System.ComponentModel.EditorBrowsable]
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlockFromUri (Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange, byte[] sourceContentHash, Azure.RequestConditions sourceConditions, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken);
Parameters
System.Uri sourceUri

Specifies the System.Uri of the source blob. The value may be a URL of up to 2 KB in length that specifies a blob. The source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.

System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the base64BlockId parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

Azure.HttpRange sourceRange

Optionally uploads only the bytes of the blob in the sourceUri in the specified range. If this is not specified, the entire source blob contents are uploaded as a single block.

System.Byte[] sourceContentHash

Optional MD5 hash of the block content from the sourceUri. This hash is used to verify the integrity of the block during transport of the data from the Uri. When this hash is specified, the storage service compares the hash of the content that has arrived from the sourceUri with this value. Note that this md5 hash is not stored with the blob. If the two hashes do not match, the operation will fail with a Azure.RequestFailedException.

Azure.RequestConditions sourceConditions

Optional Azure.RequestConditions to add conditions on the copying of data from this source blob.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on the staging of this block.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlockInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlockFromUriAsync(Uri, String, StageBlockFromUriOptions, CancellationToken)

The StageBlockFromUriAsync(Uri, String, StageBlockFromUriOptions, CancellationToken) operation creates a new block to be committed as part of a blob where the contents are read from the sourceUri.

For more information, see Put Block From URL.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockFromUriAsync (Uri sourceUri, string base64BlockId, Azure.Storage.Blobs.Models.StageBlockFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Uri sourceUri

Specifies the System.Uri of the source blob. The value may be a URL of up to 2 KB in length that specifies a blob. The source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.

System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the base64BlockId parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

StageBlockFromUriOptions options

Optional parameters. StageBlockFromUriOptions.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlockInfo>>

A Azure.Response describing the state of the updated block.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

StageBlockFromUriAsync(Uri, String, HttpRange, Byte[], RequestConditions, BlobRequestConditions, CancellationToken)

The StageBlockFromUriAsync(Uri, String, HttpRange, Byte[], RequestConditions, BlobRequestConditions, CancellationToken) operation creates a new block to be committed as part of a blob where the contents are read from the sourceUri.

For more information, see Put Block From URL.

Declaration
[System.ComponentModel.EditorBrowsable]
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockFromUriAsync (Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange, byte[] sourceContentHash, Azure.RequestConditions sourceConditions, Azure.Storage.Blobs.Models.BlobRequestConditions conditions, System.Threading.CancellationToken cancellationToken);
Parameters
System.Uri sourceUri

Specifies the System.Uri of the source blob. The value may be a URL of up to 2 KB in length that specifies a blob. The source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.

System.String base64BlockId

A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the base64BlockId parameter must be the same size for each block. Note that the Base64 string will be URL-encoded.

Azure.HttpRange sourceRange

Optionally uploads only the bytes of the blob in the sourceUri in the specified range. If this is not specified, the entire source blob contents are uploaded as a single block.

System.Byte[] sourceContentHash

Optional MD5 hash of the block content from the sourceUri. This hash is used to verify the integrity of the block during transport of the data from the Uri. When this hash is specified, the storage service compares the hash of the content that has arrived from the sourceUri with this value. Note that this md5 hash is not stored with the blob. If the two hashes do not match, the operation will fail with a Azure.RequestFailedException.

Azure.RequestConditions sourceConditions

Optional Azure.RequestConditions to add conditions on the copying of data from this source blob.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on the staging of this block.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlockInfo>>

A Azure.Response describing the state of the updated block.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

SyncUploadFromUri(Uri, Boolean, CancellationToken)

The Upload from Uri operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.

Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri (Uri copySource, bool overwrite = false, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Uri copySource

Required. Specifies the URL of the source blob. The source blob may be of any type, including a block blob, append blob, or page blob. The value may be a URL of up to 2 KiB in length that specifies a blob. The value should be URL-encoded as it would appear in a request URI. Source Blob Authentication

System.Boolean overwrite

Whether the upload should overwrite the existing blob. The default value is false.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobContentInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

SyncUploadFromUri(Uri, BlobSyncUploadFromUriOptions, CancellationToken)

The Upload from Uri operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.

Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> SyncUploadFromUri (Uri copySource, Azure.Storage.Blobs.Models.BlobSyncUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Uri copySource

Required. Specifies the URL of the source blob. The source blob may be of any type, including a block blob, append blob, or page blob. The value may be a URL of up to 2 KiB in length that specifies a blob. The value should be URL-encoded as it would appear in a request URI. Source Blob Authentication

BlobSyncUploadFromUriOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobContentInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

SyncUploadFromUriAsync(Uri, BlobSyncUploadFromUriOptions, CancellationToken)

The Upload from Uri operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.

Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync (Uri copySource, Azure.Storage.Blobs.Models.BlobSyncUploadFromUriOptions options, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Uri copySource

Required. Specifies the URL of the source blob. The source blob may be of any type, including a block blob, append blob, or page blob. The value may be a URL of up to 2 KiB in length that specifies a blob. The value should be URL-encoded as it would appear in a request URI. Source Blob Authentication

BlobSyncUploadFromUriOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobContentInfo>>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

SyncUploadFromUriAsync(Uri, Boolean, CancellationToken)

The Upload from Uri operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version.

Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob’s contents using a source URL, use the Put Block from URL API in conjunction with Put Block List.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> SyncUploadFromUriAsync (Uri copySource, bool overwrite = false, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.Uri copySource

Required. Specifies the URL of the source blob. The source blob may be of any type, including a block blob, append blob, or page blob. The value may be a URL of up to 2 KiB in length that specifies a blob. The value should be URL-encoded as it would appear in a request URI. Source Blob Authentication

System.Boolean overwrite

Whether the upload should overwrite the existing blob. The default value is false.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobContentInfo>>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

Upload(Stream, BlobUploadOptions, CancellationToken)

The Upload(Stream, BlobUploadOptions, CancellationToken) operation overwrites the contents of the blob, creating a new block blob if none exists. Overwriting an existing block blob replaces any existing metadata on the blob.

Set access conditions through Conditions to avoid overwriting existing data.

Partial updates are not supported with Upload(Stream, BlobUploadOptions, CancellationToken); the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) and CommitBlockList(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operations.

For more information, see Put Blob.

Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> Upload (System.IO.Stream content, Azure.Storage.Blobs.Models.BlobUploadOptions options, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.IO.Stream content

A System.IO.Stream containing the content to upload.

BlobUploadOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobContentInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

Upload(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken)

The Upload(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken) operation overwrites the contents of the blob, creating a new block blob if none exists. Overwriting an existing block blob replaces any existing metadata on the blob.

Set access conditions through BlobRequestConditions to avoid overwriting existing data.

Partial updates are not supported with Upload(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken); the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) and CommitBlockList(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) operations.

For more information, see Put Blob.

Declaration
[System.ComponentModel.EditorBrowsable]
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo> Upload (System.IO.Stream content, Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string,string> metadata = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, Nullable<Azure.Storage.Blobs.Models.AccessTier> accessTier = null, IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.IO.Stream content

A System.IO.Stream containing the content to upload.

BlobHttpHeaders httpHeaders

Optional standard HTTP header properties that can be set for the block blob.

System.Collections.Generic.IDictionary<System.String,System.String> metadata

Optional custom metadata to set for this block blob.

BlobRequestConditions conditions

Optional BlockBlobClient to add conditions on the creation of this new block blob.

System.Nullable<AccessTier> accessTier

Optional AccessTier Indicates the tier to be set on the blob.

System.IProgress<System.Int64> progressHandler

Optional System.IProgress to provide progress updates about data transfers.

System.Threading.CancellationToken cancellationToken

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

Returns
Azure.Response<BlobContentInfo>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

UploadAsync(Stream, BlobUploadOptions, CancellationToken)

The UploadAsync(Stream, BlobUploadOptions, CancellationToken) operation overwrites the contents of the blob, creating a new block blob if none exists. Overwriting an existing block blob replaces any existing metadata on the blob.

Set access conditions through Conditions to avoid overwriting existing data.

Partial updates are not supported with UploadAsync(Stream, BlobUploadOptions, CancellationToken); the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the StageBlock(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) and CommitBlockListAsync(IEnumerable<String>, CommitBlockListOptions, CancellationToken) operations.

For more information, see Put Blob.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> UploadAsync (System.IO.Stream content, Azure.Storage.Blobs.Models.BlobUploadOptions options, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.IO.Stream content

A System.IO.Stream containing the content to upload.

BlobUploadOptions options

Optional parameters.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobContentInfo>>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

UploadAsync(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken)

The UploadAsync(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken) operation overwrites the contents of the blob, creating a new block blob if none exists. Overwriting an existing block blob replaces any existing metadata on the blob.

Set access conditions through BlobRequestConditions to avoid overwriting existing data.

Partial updates are not supported with UploadAsync(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken); the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the StageBlockAsync(String, Stream, Byte[], BlobRequestConditions, IProgress<Int64>, CancellationToken) and CommitBlockListAsync(IEnumerable<String>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) operations.

For more information, see Put Blob.

Declaration
[System.ComponentModel.EditorBrowsable]
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> UploadAsync (System.IO.Stream content, Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string,string> metadata = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, Nullable<Azure.Storage.Blobs.Models.AccessTier> accessTier = null, IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.IO.Stream content

A System.IO.Stream containing the content to upload.

BlobHttpHeaders httpHeaders

Optional standard HTTP header properties that can be set for the block blob.

System.Collections.Generic.IDictionary<System.String,System.String> metadata

Optional custom metadata to set for this block blob.

BlobRequestConditions conditions

Optional BlobRequestConditions to add conditions on the creation of this new block blob.

System.Nullable<AccessTier> accessTier

Optional AccessTier Indicates the tier to be set on the blob.

System.IProgress<System.Int64> progressHandler

Optional System.IProgress to provide progress updates about data transfers.

System.Threading.CancellationToken cancellationToken

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

Returns
System.Threading.Tasks.Task<Azure.Response<BlobContentInfo>>

A Azure.Response describing the state of the updated block blob.

Remarks

A Azure.RequestFailedException will be thrown if a failure occurs. If multiple failures occur, an System.AggregateException will be thrown, containing each failure instance.

WithCustomerProvidedKey(Nullable<CustomerProvidedKey>)

Initializes a new instance of the BlockBlobClient class with an identical System.Uri source but the specified customerProvidedKey.

Declaration
public Azure.Storage.Blobs.Specialized.BlockBlobClient WithCustomerProvidedKey (Nullable<Azure.Storage.Blobs.Models.CustomerProvidedKey> customerProvidedKey);
Parameters
System.Nullable<CustomerProvidedKey> customerProvidedKey

The customer provided key.

Returns
BlockBlobClient

A new BlockBlobClient instance.

Remarks

Pass null to remove the customer provide key in the returned BlockBlobClient.

WithEncryptionScope(String)

Initializes a new instance of the BlockBlobClient class with an identical System.Uri source but the specified encryptionScope.

Declaration
public Azure.Storage.Blobs.Specialized.BlockBlobClient WithEncryptionScope (string encryptionScope);
Parameters
System.String encryptionScope

The encryption scope.

Returns
BlockBlobClient

A new BlockBlobClient instance.

Remarks

Pass null to remove the encryption scope in the returned BlockBlobClient.

WithSnapshot(String)

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

For more information, see Create a snapshot of a blob.

Declaration
public Azure.Storage.Blobs.Specialized.BlockBlobClient WithSnapshot (string snapshot);
Parameters
System.String snapshot

The snapshot identifier.

Returns
BlockBlobClient

A new BlockBlobClient instance.

Remarks

Pass null or empty string to remove the snapshot returning a URL

to the base blob.

WithSnapshotCore(String)

Creates a new instance of the BlockBlobClient class with an identical System.Uri source but the specified snapshot timestamp.

Declaration
protected override sealed Azure.Storage.Blobs.Specialized.BlobBaseClient WithSnapshotCore (string snapshot);
Parameters
System.String snapshot

The snapshot identifier.

Returns
BlobBaseClient

A new BlockBlobClient instance.

WithVersion(String)

Initializes a new instance of the BlockBlobClient class with an identical System.Uri source but the specified versionId timestamp.

Declaration
public Azure.Storage.Blobs.Specialized.BlockBlobClient WithVersion (string versionId);
Parameters
System.String versionId

The version identifier.

Returns
BlockBlobClient

A new BlockBlobClient instance.

Remarks

Pass null or empty string to remove the snapshot returning a URL

to the base blob.

Extension Methods

SpecializedBlobExtensions.GetBlobLeaseClient(BlobBaseClient, String)
SpecializedBlobExtensions.GetParentBlobContainerClient(BlobBaseClient)
Back to top Azure SDK for .NET