How to list containers in azure blob repository?

I am developing a social network application.

I want to create a container in the azure storage for each user (client) connecting the social network, which means that user 1 has a container named container 1, and inside container 1 there will be user profile 1 in xml format and user profile 1.

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

If I want to list all 9 user information stored in Azure storage in different 9 containers from user 1, how can I do this?

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

+7
source share
2 answers

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(); 
+42
source
 CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); // We need to access blobs now, so create a CloudBlobClient blobClient = account.CreateCloudBlobClient(); IEnumerable<CloudBlobContainer> containers = blobClient.ListContainers(); // This will return you list of containers var containerList = containers.Select(e => e.Name).Tolist(); 
0
source

All Articles