0
我有一个对所有人都公开的天蓝色容器,我想检索该公共容器中存在的文件名。无法从azure blob容器获取文件名
这是我的代码。
// Retrieve storage account from connection string.
var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference(sourceurl); //my path from where i have to get filename
//here i got 400 bad request error.
var blobs = container.ListBlobs(null, true, BlobListingDetails.All).Cast<CloudBlockBlob>().ToList();
foreach (var blockBlob in blobs)
{
Console.WriteLine("Name: " + blockBlob.Name);
Console.WriteLine("Size: " + blockBlob.Properties.Length);
Console.WriteLine("Content type: " + blockBlob.Properties.ContentType);
Console.WriteLine("Download location: " + blockBlob.Uri);
Console.WriteLine("=======================================");
}
'sourceurl'的价值是什么? –
sourceurl是我从哪里访问我的文件的完整容器地址。例如:“vcmobilesiteiislogs/VCMOBILESITE/2015/07/10/10 /” –
因此,您的容器名称为'vcmobilesiteiislogs',并且您想要从VCMOBILESITE/2015/07/10/10 /'文件夹中提取文件。正确? –