如何使用C#从Azure存储下载所有文件?

时间:2015-05-07 07:13:50

标签: c# download azure-storage-blobs

我是Azure存储的新手。所以,请在帖子中考虑我的内容。 我有Azure Storag个帐号我们有all files stored。现在,我希望将download files folder by looping through each directory and sub directory of the Azure Storage改为// Retrieve storage account from connection string. CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); // Create the blob client. CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); // Retrieve reference to a previously created container. CloudBlobContainer container = blobClient.GetContainerReference("mycontainer"); // Retrieve reference to a blob named "photo1.jpg". CloudBlockBlob blockBlob = container.GetBlockBlobReference("photo1.jpg"); // Save blob contents to a file. using (var fileStream = System.IO.File.OpenWrite(@"path\myfile")) { blockBlob.DownloadToStream(fileStream); }

示例代码:

var title = document.createElementNS('http://www.w3.org/2000/svg', 'title');
title.textContent = data[i].title;//JSON object That works
title.setAttribute('class','tooltip');

但我无法通过子内容获得所有' Container' 及其内容

帮助感谢!

1 个答案:

答案 0 :(得分:0)

使用blobClient。ListContainers()获取所有容器,并使用容器。ListBlobs()获取容器中的所有blob。