获取列表中的WinRT应用程序中的BLOB [英] Getting List the blob in winRt application
本文介绍了获取列表中的WinRT应用程序中的BLOB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想列出斑点在一个容器中。对于桌面应用程序,在Azure存储SDK提供了以下方法:
I would like to list blobs in a container. For desktop apps, the Azure Storage SDK provides the following method:
CloudBlobContainer container = blobClient.GetContainerReference("myBlob");
container.ListBlobs();
然而,使用<一href=\"https://github.com/WindowsAzure/azure-sdk-for-net/tree/master/microsoft-azure-api/Services/Storage/Lib/RT\"相对=nofollow> WinRT的库上的方法是不存在(可能是由于其阻挡性质)。我应该用什么呢?
However, using the WinRT library the method is absent (probably due to its blocking nature). What should I use instead?
推荐答案
您需要使用 ListBlobsSegmentedAsync
功能BLOB容器上获取斑点的列表。见code以下,例如:
You would need to use ListBlobsSegmentedAsync
function on the blob container to fetch the list of blobs. See the code below for example:
CloudStorageAccount account = new CloudStorageAccount(new StorageCredentials("accountname", "accountkey"), true);
var client = account.CreateCloudBlobClient();
var container = client.GetContainerReference("containername");
BlobContinuationToken continuationToken = null;
string prefix = null;
bool useFlatBlobListing = true;
BlobListingDetails blobListingDetails = BlobListingDetails.All;
int maxBlobsPerRequest = 10;
List<IListBlobItem> blobs = new List<IListBlobItem>();
do
{
var listingResult = await container.ListBlobsSegmentedAsync(prefix, useFlatBlobListing, blobListingDetails, maxBlobsPerRequest, continuationToken, null, null);
continuationToken = listingResult.ContinuationToken;
blobs.AddRange(listingResult.Results);
}
while (continuationToken != null);
这篇关于获取列表中的WinRT应用程序中的BLOB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文