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

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

问题描述

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

I am developing a social network application.

我想在 azure 存储中为每个加入社交网络的用户(客户端)创建一个容器,这意味着 user1 有一个名为 container 1 的容器,在容器 1 中将有一个 xml 格式的用户 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,然后将用户 2 配置文件保存为 xml 格式和用户 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.

如果我想列出存储在 Azure 存储中与用户客户端 1 不同的 9 个容器中的所有 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?

我正在使用网络服务,但我面临的挑战是如何收集位于 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();

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

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