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 100 MB (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 slightly more than 4.75 TB (100 MB X 50,000 blocks). If you are writing a block blob that is no more than 256 MB in size, you can upload it in its entirety with a single write operation; see UploadAsync(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, 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, but their total size cannot exceed 200,000 MB.
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).
Inherited Members
Namespace: Azure.Storage.Blobs.Specialized
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
Uri
blobUri
A 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
String
connectionString
A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime. |
String
containerName
The name of the container containing this block blob. |
String
blobName
The name of this block blob. |
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
Uri
blobUri
A Uri referencing the blob that includes the name of the account, the name of the container, and the name of the blob. |
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)
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
String
connectionString
A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime. |
String
blobContainerName
The name of the container containing this block blob. |
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
Int32
|
BlockBlobMaxStageBlockBytes
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 int BlockBlobMaxStageBlockBytes { get; }
Property Value
Int32
|
BlockBlobMaxUploadBlobBytes
Gets the maximum number of bytes that can be sent in a call to UploadAsync(Stream, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, IProgress<Int64>, CancellationToken).
Declaration
public virtual int BlockBlobMaxUploadBlobBytes { get; }
Property Value
Int32
|
Methods
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 and permanently deleted.
Declaration
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
IEnumerable<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 RequestFailedException will be thrown. |
BlobHttpHeaders
httpHeaders
Optional standard HTTP header properties that can be set for the block blob. |
IDictionary<String,String>
metadata
Optional custom metadata to set for this block blob. |
BlobRequestConditions
conditions
Optional BlockBlobClient to add conditions on committing this block list. |
Nullable<AccessTier>
accessTier
Optional AccessTier Indicates the tier to be set on the blob. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Response<BlobContentInfo>
A Response<T> describing the state of the updated block blob. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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 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 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 and permanently deleted.
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.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
IEnumerable<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 RequestFailedException will be thrown. |
BlobHttpHeaders
httpHeaders
Optional standard HTTP header properties that can be set for the block blob. |
IDictionary<String,String>
metadata
Optional custom metadata to set for this block blob. |
BlobRequestConditions
conditions
Optional BlockBlobClient to add conditions on committing this block list. |
Nullable<AccessTier>
accessTier
Optional AccessTier Indicates the tier to be set on the blob. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Task<Response<BlobContentInfo>>
A Response<T> describing the state of the updated block blob. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, 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. |
String
snapshot
Optionally specifies the blob snapshot to retrieve the block list from. For more information on working with blob snapshots, see . |
BlobRequestConditions
conditions
Optional BlobRequestConditions to add conditions on retrieving the block list. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Response<BlockList>
A Response<T> describing requested block list. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, 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. |
String
snapshot
Optionally specifies the blob snapshot to retrieve the block list from. For more information on working with blob snapshots, see . |
BlobRequestConditions
conditions
Optional BlobRequestConditions to add conditions on retrieving the block list. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Task<Response<BlockList>>
A Response<T> describing requested block list. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) operation.
Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlock (string base64BlockId, System.IO.Stream content, byte[] transactionalContentHash = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
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 must be URL-encoded. |
Stream
content
A Stream containing the content to upload. |
Byte[]
transactionalContentHash
An optional MD5 hash of the block |
BlobRequestConditions
conditions
Optional BlobRequestConditions to add conditions on the upload of this block. |
IProgress<Int64>
progressHandler
Optional IProgress<T> to provide progress updates about data transfers. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Response<BlockInfo>
A Response<T> describing the state of the updated block. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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>, BlobHttpHeaders, IDictionary<String,String>, BlobRequestConditions, Nullable<AccessTier>, CancellationToken) operation.
Declaration
[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 = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
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 must be URL-encoded. |
Stream
content
A Stream containing the content to upload. |
Byte[]
transactionalContentHash
An optional MD5 hash of the block |
BlobRequestConditions
conditions
Optional BlobRequestConditions to add conditions on the upload of this block. |
IProgress<Int64>
progressHandler
Optional IProgress<T> to provide progress updates about data transfers. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Task<Response<BlockInfo>>
A Response<T> describing the state of the updated block. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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
.
Declaration
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlockInfo> StageBlockFromUri (Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange = null, byte[] sourceContentHash = null, Azure.RequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Uri
sourceUri
Specifies the 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. |
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 |
HttpRange
sourceRange
Optionally uploads only the bytes of the blob in the
|
Byte[]
sourceContentHash
Optional MD5 hash of the block content from the
|
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. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Response<BlockInfo>
A Response<T> describing the state of the updated block blob. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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
.
Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlockInfo>> StageBlockFromUriAsync (Uri sourceUri, string base64BlockId, Azure.HttpRange sourceRange = null, byte[] sourceContentHash = null, Azure.RequestConditions sourceConditions = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Uri
sourceUri
Specifies the 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. |
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 |
HttpRange
sourceRange
Optionally uploads only the bytes of the blob in the
|
Byte[]
sourceContentHash
Optional MD5 hash of the block content from the
|
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. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Task<Response<BlockInfo>>
A Response<T> describing the state of the updated block. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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 creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob.
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.
Declaration
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
Stream
content
A Stream containing the content to upload. |
BlobHttpHeaders
httpHeaders
Optional standard HTTP header properties that can be set for the block blob. |
IDictionary<String,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. |
Nullable<AccessTier>
accessTier
Optional AccessTier Indicates the tier to be set on the blob. |
IProgress<Int64>
progressHandler
Optional IProgress<T> to provide progress updates about data transfers. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Response<BlobContentInfo>
A Response<T> describing the state of the updated block blob. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
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 creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob.
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.
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.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
Stream
content
A Stream containing the content to upload. |
BlobHttpHeaders
httpHeaders
Optional standard HTTP header properties that can be set for the block blob. |
IDictionary<String,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. |
Nullable<AccessTier>
accessTier
Optional AccessTier Indicates the tier to be set on the blob. |
IProgress<Int64>
progressHandler
Optional IProgress<T> to provide progress updates about data transfers. |
CancellationToken
cancellationToken
Optional CancellationToken to propagate notifications that the operation should be cancelled. |
Returns
Task<Response<BlobContentInfo>>
A Response<T> describing the state of the updated block blob. |
Remarks
A RequestFailedException will be thrown if a failure occurs.
WithSnapshot(String)
Initializes a new instance of the BlockBlobClient
class with an identical Uri source but the specified
snapshot
timestamp.
Declaration
public Azure.Storage.Blobs.Specialized.BlockBlobClient WithSnapshot (string snapshot);
Parameters
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 Uri source but the specified
snapshot
timestamp.
Declaration
protected override sealed Azure.Storage.Blobs.Specialized.BlobBaseClient WithSnapshotCore (string snapshot);
Parameters
String
snapshot
The snapshot identifier. |
Returns
BlobBaseClient
A new BlockBlobClient instance. |