BlobRequestOptions.StoreBlobContentMD5 Property

Definition

Gets or sets a value to indicate that an MD5 hash will be calculated and stored when uploading a blob.

public bool? StoreBlobContentMD5 { get; set; }
member this.StoreBlobContentMD5 : Nullable<bool> with get, set
Public Property StoreBlobContentMD5 As Nullable(Of Boolean)

Property Value

Use true to calculate and store an MD5 hash when uploading a blob; otherwise, false. Defaults to false.

Examples

MemoryStream sourceStream;

// Instruct the Storage Client to calculate and store the MD5 of the blob on upload.
BlobRequestOptions optionsWithStoreBlobContentMD5 = new BlobRequestOptions() { StoreBlobContentMD5 = true };

using (sourceStream = new MemoryStream(blobContent))
{
    testBlob.UploadFromStream(sourceStream, accessCondition: null, options: optionsWithStoreBlobContentMD5);
}

Remarks

This property is not supported for the CloudAppendBlob Append* APIs. The StoreBlobContentMD5 request option instructs the Storage Client to calculate the MD5 hash of the blob content during an upload operation. This value is then stored on the blob object as the Content-MD5 header. This option applies only to upload operations. This is useful for validating the integrity of the blob upon later download, and compatible with the Content-MD5 header as defined in the HTTP spec. If using the Storage Client for later download, if the Content-MD5 header is present, the MD5 hash of the content will be validated, unless "DisableContentMD5Validation" is set. Note that this value is not validated on the Azure Storage service on either upload or download of data; it is merely stored and returned.

Applies to