Note that there are some explanatory texts on larger screens.

plurals
  1. POAzure Storage CloudBlob.Properties are not initialized when using GetBlobReference()
    primarykey
    data
    text
    <p>I'm trying to get some information about Azure blob (last modified UTC date time). This information is stored CloudBlob.Properties.LastModifiedUtc property.</p> <p>If I use method GetBlobReference() or GetBlockBlobReference(), the Properties of the blob are not initialized (LastModifiedUtc is DateTime.MinDate). If I use ListBlobs() the Properties are initialized correctly (LastModifiedUtc has correct value).</p> <p>Am I doing something wrong when using GetBlobReference function? Is there some way how to get CloudBlob instance just for one specific blob? I know I can missue ListBlobs() and filter just the blob I'm interested in, or use ListBlobsWithPrefix() from class CloudBlobClient, but I would expect to get all the metadata when I ask for specific Blob Reference.</p> <p>Code showing how I'm working with Azure blobs:</p> <pre><code> string storageAccountName = "test"; string storageAccountKey = @"testkey"; string blobUrl = "https://test.blob.core.windows.net"; string containerName = "testcontainer"; string blobName = "testbontainer"; var credentials = new StorageCredentialsAccountAndKey(storageAccountName, storageAccountKey); var cloudBlobClient = new CloudBlobClient(blobUrl, credentials); var containerReference = cloudBlobClient.GetContainerReference(string.Format("{0}/{1}", blobUrl, containerName)); // OK - Result is of type CloudBlockBlob, cloudBlob_ListBlobs.Properties.LastModifiedUtc &gt; DateTime.MinValue var cloudBlob_ListBlobs = containerReference.ListBlobs().Where(i =&gt; i is CloudBlob &amp;&amp; ((CloudBlob)i).Name == blobName).FirstOrDefault() as CloudBlob; // WRONG - Result is of type CloudBlob, cloudBlob_GetBlobReference.Properties.LastModifiedUtc == DateTime.MinValue var cloudBlob_GetBlobReference = containerReference.GetBlobReference(string.Format("{0}/{1}/{2}", blobUrl, containerName, blobName)); // WRONG - Result is of type CloudBlockBlob, cloudBlob_GetBlockBlobReference.Properties.LastModifiedUtc == DateTime.MinValue var cloudBlob_GetBlockBlobReference = containerReference.GetBlockBlobReference(string.Format("{0}/{1}/{2}", blobUrl, containerName, blobName)); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload