C# code to Get Blob files

Rajnilari2015
Posted by Rajnilari2015 under Azure category on | Points: 40 | Views : 100
The below code will do so

public List<string> GetBlobFiles(string connectionString, string containerName)
{
var blobFiles = new List<string>();
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudBlobClient blobclient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer blobcontainer = blobclient.GetContainerReference(containerName);
foreach (IListBlobItem item in blobcontainer.ListBlobs(null, false))
{
if (item.GetType() == typeof(CloudBlockBlob))
{
CloudBlockBlob blob = (CloudBlockBlob)item;
blobFiles.Add(blob.Name);
}
}
return blobFiles;
}

Comments or Responses

Login to post response