Fetch Azure blob metadata only if the blob exists

Viewed 1196

I need to fetch the metadata for an Azure blob if it exists and would like to achieve this with minimal REST calls (by the storage SDK to the storage service)

I know I can do something like

  • CloudBlockBlob.ExistsAsync() and then
  • CloudBlockBlob.FetchAttributesAsync() if the blob exists

I tried to combine these 2 calls into one

  • CloudBlockBlob.FetchAttributesAsync(AccessCondition.GenerateIfExistsCondition(),new BlobRequestOptions(), new OperationContext());

Docs on 'AccessCondition.GenerateIfExistsCondition()' say -

Constructs an access condition such that an operation will be performed only if the resource exists.

but it still fails with a 404 not found.

Any idea if what I want to achieve is even possible and what I might be doing wrong?

1 Answers
Related