In my app i want all the blob of my container but in my code (as below) there is not Listblob() method in CloudBlobContainer variable container. Am i missing something?
var credentials = new StorageCredentials("xxx", "a37bijfRGGdgaVU+ITEIi0Cp1VrbzMM7Bc9PbMOw2FPAz9twgR+lbTzqGhBfHeJe7UfEp4CXtLxqY5Ek0/5zdg==");
var client = new CloudBlobClient(new Uri("https://xxx.blob.core.windows.net/"), credentials);
var container = client.GetContainerReference("publicimage");
//this container variable has not ListBlobs() method
foreach(IListBlobItem item in container.ListBlobsSegmentedAsync())
{
}
ListBlobs is a synchronous method and therefore is missing on platforms that do not support synchronous methods such as Windows Phone. The reason is that calling a synchronous method on a UI thread would block the UI and make the application unresponsive.
The alternative is to use the *Async overloads. However, please note that there is no ListBlobsAsync, because there is no async counterpart of IEnumerable in .NET. So, you should call ListBlobsSegmentedAsync and handle the continuation token that it returns.
If you would like to see an example usage, I would recommend looking at Azure Storage Client Library's unit tests (see test CloudBlobContainerListBlobsSegmentedAsync in CloudBlobContainerTest.cs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With