Ich erhalte eine Liste von IListBlobItems mit CloudBlobContainer.ListBlobs
. Ich bin dann über jeden Eintrag Looping um die Größe des Blobs zu zeigen, mit dem folgenden Code:Microsoft.WindowsAzure.StorageClient.CloudBlockBlob.DownloadBlockList gibt 0 Blöcke zurück
foreach (IListBlobItem item in blobs)
{
if (item.GetType() == typeof(CloudBlobDirectory))
{ }
else if (item.GetType() == typeof(CloudBlockBlob))
{
CloudBlockBlob blockBlob = (CloudBlockBlob)item;
IEnumerable<ListBlockItem> blocks = blockBlob.DownloadBlockList(new BlobRequestOptions { BlobListingDetails = BlobListingDetails.All });
Console.WriteLine(blockBlob.Name.PadRight(50, ' ') +
blocks.Sum(b => b.Size));
}
else
{
Console.WriteLine(item.Uri.LocalPath);
}
}
Allerdings, wenn ich die Zählung auf der Variable blocks
überprüfen, es ist immer 0. Warum ist das so?
Perfekt! Genau das, wonach ich suche. –