<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" />

Microsoft.Azure.Storage.Blob.CloudBlob

public class CloudBlob : IListBlobItem
Represents a blob.
public BlobType BlobType { get; }

Gets the type of the blob.

public CloudBlobContainer Container { get; }

Gets a CloudBlobContainer object representing the blob's container.

public virtual CopyState CopyState { get; }

Gets the state of the most recent or pending copy operation.

public bool IsDeleted { get; }

Gets a value indicating whether or not this blob has been deleted.

public bool IsSnapshot { get; }

Gets a value indicating whether this blob is a snapshot.

public IDictionary<string, string> Metadata { get; }

Gets the user-defined metadata for the blob.

public virtual string Name { get; }

Gets the name of the blob.

public CloudBlobDirectory Parent { get; }

Gets the CloudBlobDirectory object representing the virtual parent directory for the blob.

public BlobProperties Properties { get; }

Gets the blob's system properties.

Gets the CloudBlobClient object that represents the Blob service.

public StorageUri SnapshotQualifiedStorageUri { get; }

Gets the blob's URI for both the primary and secondary locations, including query string information if the blob is a snapshot.

public Uri SnapshotQualifiedUri { get; }

Gets the absolute URI to the blob, including query string information if the blob is a snapshot.

public DateTimeOffset? SnapshotTime { get; }

Gets the date and time that the blob snapshot was taken, if this blob is a snapshot.

public StorageUri StorageUri { get; }

Gets the blob's URIs for both the primary and secondary locations.

public int StreamMinimumReadSizeInBytes { get; set; }

Gets or sets the minimum number of bytes to buffer when reading from a blob stream.

public Uri Uri { get; }

Gets the blob's URI for the primary location.

public CloudBlob(Uri blobAbsoluteUri)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public CloudBlob(Uri blobAbsoluteUri, StorageCredentials credentials)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public CloudBlob(Uri blobAbsoluteUri, CloudBlobClient client)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public CloudBlob(Uri blobAbsoluteUri, DateTimeOffset? snapshotTime, StorageCredentials credentials)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public CloudBlob(Uri blobAbsoluteUri, DateTimeOffset? snapshotTime, CloudBlobClient client)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public CloudBlob(StorageUri blobAbsoluteUri, DateTimeOffset? snapshotTime, StorageCredentials credentials)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public CloudBlob(StorageUri blobAbsoluteUri, DateTimeOffset? snapshotTime, CloudBlobClient client)

Initializes a new instance of the CloudBlob class using an absolute URI to the blob.

public virtual Task AbortCopyAsync(string copyId)

Aborts an ongoing blob copy operation.

public virtual Task AbortCopyAsync(string copyId, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Aborts an ongoing blob copy operation.

public virtual Task AbortCopyAsync(string copyId, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Aborts an ongoing blob copy operation.

public virtual Task<string> AcquireLeaseAsync(TimeSpan? leaseTime, string proposedLeaseId = null)

Acquires a lease on this blob.

public virtual Task<string> AcquireLeaseAsync(TimeSpan? leaseTime, string proposedLeaseId, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Acquires a lease on this blob.

public virtual Task<string> AcquireLeaseAsync(TimeSpan? leaseTime, string proposedLeaseId, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Acquires a lease on this blob.

public virtual Task<TimeSpan> BreakLeaseAsync(TimeSpan? breakPeriod)

Breaks the current lease on this blob.

public virtual Task<TimeSpan> BreakLeaseAsync(TimeSpan? breakPeriod, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Breaks the current lease on this blob.

public virtual Task<TimeSpan> BreakLeaseAsync(TimeSpan? breakPeriod, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Breaks the current lease on this blob.

public virtual Task<string> ChangeLeaseAsync(string proposedLeaseId, AccessCondition accessCondition)

Changes the lease ID on this blob.

public virtual Task<string> ChangeLeaseAsync(string proposedLeaseId, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Changes the lease ID on this blob.

public virtual Task<string> ChangeLeaseAsync(string proposedLeaseId, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Changes the lease ID on this blob.

public virtual Task DeleteAsync()

Deletes the blob.

public virtual Task DeleteAsync(DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Deletes the blob.

public virtual Task DeleteAsync(DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Deletes the blob.

public virtual Task<bool> DeleteIfExistsAsync()

Deletes the blob if it already exists.

public virtual Task<bool> DeleteIfExistsAsync(DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Deletes the blob if it already exists.

public virtual Task<bool> DeleteIfExistsAsync(DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Deletes the blob if it already exists.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? blobOffset, long? length)

Downloads a range of bytes from a blob to a byte array.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? blobOffset, long? length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Downloads a range of bytes from a blob to a byte array.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? blobOffset, long? length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads a range of bytes from a blob to a byte array.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? blobOffset, long? length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads a range of bytes from a blob to a byte array.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length)

Downloads a range of bytes from a blob to a stream.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Downloads a range of bytes from a blob to a stream.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads a range of bytes from a blob to a stream.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads a range of bytes from a blob to a stream.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index)

Downloads the contents of a blob to a byte array.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Downloads the contents of a blob to a byte array.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a blob to a byte array.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a blob to a byte array.

public virtual Task DownloadToFileAsync(string path, FileMode mode)

public virtual Task DownloadToFileAsync(string path, FileMode mode, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

public virtual Task DownloadToFileAsync(string path, FileMode mode, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a blob to a file.

public virtual Task DownloadToFileAsync(string path, FileMode mode, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a blob to a file.

public virtual Task DownloadToStreamAsync(Stream target)

Downloads the contents of a blob to a stream.

public virtual Task DownloadToStreamAsync(Stream target, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Downloads the contents of a blob to a stream.

public virtual Task DownloadToStreamAsync(Stream target, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a blob to a stream.

public virtual Task DownloadToStreamAsync(Stream target, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a blob to a stream.

public virtual Task<bool> ExistsAsync()

Checks existence of the blob.

public virtual Task<bool> ExistsAsync(BlobRequestOptions options, OperationContext operationContext)

Checks existence of the blob.

public virtual Task<bool> ExistsAsync(BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Checks existence of the blob.

public virtual Task FetchAttributesAsync()

Populates a blob's properties and metadata.

public virtual Task FetchAttributesAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Populates a blob's properties and metadata.

public virtual Task FetchAttributesAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Populates a blob's properties and metadata.

public virtual Task<AccountProperties> GetAccountPropertiesAsync()

Initiates an asynchronous operation to get properties for the account this blob resides on.

public virtual Task<AccountProperties> GetAccountPropertiesAsync(CancellationToken cancellationToken)

Initiates an asynchronous operation to get properties for the account this blob resides on.

public virtual Task<AccountProperties> GetAccountPropertiesAsync(BlobRequestOptions requestOptions, OperationContext operationContext)

Initiates an asynchronous operation to get properties for the account this blob resides on.

public virtual Task<AccountProperties> GetAccountPropertiesAsync(BlobRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)

Initiates an asynchronous operation to get properties for the account this blob resides on.

Returns a shared access signature for the blob.

public string GetSharedAccessSignature(SharedAccessBlobPolicy policy, string groupPolicyIdentifier)

Returns a shared access signature for the blob.

Returns a shared access signature for the blob.

public string GetSharedAccessSignature(SharedAccessBlobPolicy policy, SharedAccessBlobHeaders headers, string groupPolicyIdentifier)

Returns a shared access signature for the blob.

public string GetSharedAccessSignature(SharedAccessBlobPolicy policy, SharedAccessBlobHeaders headers, string groupPolicyIdentifier, SharedAccessProtocol? protocols, IPAddressOrRange ipAddressOrRange)

Returns a shared access signature for the blob.

public string GetUserDelegationSharedAccessSignature(UserDelegationKey delegationKey, SharedAccessBlobPolicy policy, SharedAccessBlobHeaders headers = null, SharedAccessProtocol? protocols = default, IPAddressOrRange ipAddressOrRange = null)

Returns an user-delegation-based shared access signature for the blob, with credentials solely based on the UserDelegationKey provided.

public virtual Task<Stream> OpenReadAsync()

Opens a stream for reading from the blob.

public virtual Task<Stream> OpenReadAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Opens a stream for reading from the blob.

public virtual Task<Stream> OpenReadAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Opens a stream for reading from the blob.

public virtual Task ReleaseLeaseAsync(AccessCondition accessCondition)

Releases the lease on this blob.

public virtual Task ReleaseLeaseAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Releases the lease on this blob.

public virtual Task ReleaseLeaseAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Releases the lease on this blob.

public virtual Task RenewLeaseAsync(AccessCondition accessCondition)

Renews a lease on this blob.

public virtual Task RenewLeaseAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Renews a lease on this blob.

public virtual Task RenewLeaseAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Renews a lease on this blob.

public virtual Task SetMetadataAsync()

Updates the blob's metadata.

public virtual Task SetMetadataAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Updates the blob's metadata.

public virtual Task SetMetadataAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Updates the blob's metadata.

public virtual Task SetPropertiesAsync()

Updates the blob's properties.

public virtual Task SetPropertiesAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Updates the blob's properties.

public virtual Task SetPropertiesAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Updates the blob's properties.

public virtual Task<CloudBlob> SnapshotAsync()

Creates a snapshot of the blob.

public virtual Task<CloudBlob> SnapshotAsync(IDictionary<string, string> metadata, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Creates a snapshot of the blob.

public virtual Task<CloudBlob> SnapshotAsync(IDictionary<string, string> metadata, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Creates a snapshot of the blob.

public virtual Task<string> StartCopyAsync(Uri source)

Begins an operation to start copying an existing blob's contents, properties, and metadata to a new blob.

public virtual Task<string> StartCopyAsync(Uri source, CancellationToken cancellationToken)

Initiates an asynchronous operation to start copying another blob's contents, properties, and metadata to this blob.

public virtual Task<string> StartCopyAsync(Uri source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, BlobRequestOptions options, OperationContext operationContext)

Begins an operation to start copying an existing blob's contents, properties, and metadata to a new blob.

public virtual Task<string> StartCopyAsync(Uri source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Begins an operation to start copying a blob's contents, properties, and metadata to a new blob.

public virtual Task<string> StartCopyAsync(Uri source, PremiumPageBlobTier? premiumPageBlobTier, StandardBlobTier? standardBlockBlobTier, RehydratePriority? rehydratePriority, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Initiates an asynchronous operation to start copying another blob's contents, properties, and metadata to this blob.

public virtual Task UndeleteAsync()

Initiates an asynchronous operation to undelete the soft-deleted blob.

public virtual Task UndeleteAsync(CancellationToken cancellationToken)

Initiates an asynchronous operation to undelete the soft-deleted blob.

public virtual Task UndeleteAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)

Initiates an asynchronous operation to undelete the soft-deleted blob.

public virtual Task UndeleteAsync(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Initiates an asynchronous operation to undelete the soft-deleted blob.