Reputation: 233
I've a BLOB container in Azure where I've saved some block BLOBs. The following code is a method to read a specific BLOB, I would save in a variable the BLOB ETag but it returns always null.
public static string DownloadAsText(string ContainerName, string BlobName, out string ETag)
{
CloudBlobContainer BlobContainer = CreateCloudBlobClient().GetContainerReference(ContainerName);
CloudBlockBlob Blob = BlobContainer.GetBlockBlobReference(BlobName);
ETag = Blob.Properties.ETag;
return Blob.DownloadText();
}
Upvotes: 0
Views: 2164
Reputation: 18465
As I know, CloudBlockBlob.GetBlockBlobReference
just returns a reference to a block blob within the container on your client-side. In order to retrieve the properties of your Blob, you need to send a request to the server-side explicitly.
Additionally, ETag is used to manage concurrency in the Blob Service. It’s an identifier of your blob(file) and is updated every time when an update operation is performed on your blob(file). For more details, you could follow this official tutorial to have a better understanding of ETag and make good use of it.
Upvotes: 2