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).
Inherited Members
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)
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 and permanently deleted.
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.
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.
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.
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 and permanently deleted.
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.
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 and permanently deleted.
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.
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.
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.
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.
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.
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.
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.
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
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
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 must be URL-encoded. |
System.IO.Stream
content
A System.IO.Stream containing the content to upload. |
System.Byte[]
transactionalContentHash
An optional MD5 hash of the block |
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.
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.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
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 must be URL-encoded. |
System.IO.Stream
content
A System.IO.Stream containing the content to upload. |
System.Byte[]
transactionalContentHash
An optional MD5 hash of the block |
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.
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
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
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 |
Azure.HttpRange
sourceRange
Optionally uploads only the bytes of the blob in the
|
System.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. |
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.
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.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
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 |
Azure.HttpRange
sourceRange
Optionally uploads only the bytes of the blob in the
|
System.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. |
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.
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. The source blob must either be public or must be authorized via a shared access signature. If the source blob is public, no authorization is required to perform the operation. |
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.
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. The source blob must either be public or must be authorized via a shared access signature. If the source blob is public, no authorization is required to perform the operation. |
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.
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. The source blob must either be public or must be authorized via a shared access signature. If the source blob is public, no authorization is required to perform the operation. |
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.
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. The source blob must either be public or must be authorized via a shared access signature. If the source blob is public, no authorization is required to perform the operation. |
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.
Upload(Stream, BlobUploadOptions, CancellationToken)
The Upload(Stream, BlobUploadOptions, 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, 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.
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.
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.
UploadAsync(Stream, BlobUploadOptions, CancellationToken)
The UploadAsync(Stream, BlobUploadOptions, 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, 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.
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.
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.
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.