如何列出天蓝色blob存储中的容器? [英] How to List the containers in azure blob storage?

查看:78
本文介绍了如何列出天蓝色blob存储中的容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个社交网络应用程序.

I am developing a social network application.

我想在azure存储中为每个加入社交网络的用户(客户端)创建一个容器,这意味着user1有一个名为container 1的容器,并且在container 1内将有xml格式的user 1配置文件和一个用户1的个人资料图片.

I want to creat ,in azure storage, a container for each user (client) joining a social network, which means user1 has a container named container 1, and inside container 1 there will be user 1 profile in xml format and a profile picture of user 1.

类似地,对于user2,将在azure blob存储中创建容器2,然后以xml格式保存用户2的配置文件和用户2的配置文件图片,就像这样,假设有10个用户10个容器.

Similarly, for user2 there will be container 2 created in azure blob storage and then user 2 profile is saved in xml format and profile picture of user 2, and it goes like this so for, let say, 10 users there will be 10 containers.

如果我要列出用户客户端1中不同9个容器中存储在Azure存储中的所有9位用户的信息,我该怎么办?

If i want to list all 9 users' information stored in Azure storage in different 9 containers from user client 1, how could i do that?

我正在使用Web服务,但是我面临的挑战是如何收集位于9个不同容器中的所有9个用户个人资料信息.

I am using webservice, but the challenge I am facing is how to collect all the 9 user profile information located in 9 different containers.

推荐答案

以下应该可以解决问题-

The following should do the trick -

            CloudStorageAccount account =
            CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
        // We need to access blobs now, so create a CloudBlobClient
        CloudBlobClient blobClient = account.CreateCloudBlobClient();

        IEnumerable<CloudBlobContainer> containers = blobClient.ListContainers();

这篇关于如何列出天蓝色blob存储中的容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆