0

I have created a Container named Content in azure using c#. I have uploaded files under this container as "Images\myfile1.jpg","Images\myfile2.jpg","Images\myfile3.jpg"

I want to get the list of all blobs that are uploaded in Content container > Images folder.

Is there any way to get that list?

Sonali
  • 2,223
  • 6
  • 32
  • 69

1 Answers1

1

I want to get the list of all blobs that are uploaded in Content container > Images folder.

The List Blobs operation can enumerate the list of blobs under the specified container, and you can make the results to return only blobs whose names begin with the specified prefix by specifying the prefix parameter on the URI.

edit:

If you'd like to using Microsoft Azure Storage Client Library for .NET, you can call ListBlobs Method and specify the prefix parameter to filter the results.

CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName={account_name};AccountKey={account_key};EndpointSuffix=core.windows.net");

CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

CloudBlobContainer container = blobClient.GetContainerReference("Content");

List<IListBlobItem> blobslist = container.ListBlobs("Images", true).ToList(); 
Fei Han
  • 26,415
  • 1
  • 30
  • 41
  • using this `var query = container.ListBlobs(prefix: folderName, useFlatBlobListing: true, blobListingDetails: BlobListingDetails.None);` – Sonali Aug 01 '17 at 08:47
  • If you are using Microsoft Azure Storage Client Library for .NET, [CloudBlobContainer.ListBlobs Method](https://learn.microsoft.com/en-us/dotnet/api/microsoft.windowsazure.storage.blob.cloudblobcontainer.listblobs?view=azurestorage-8.1.3) also accept ``prefix`` parameter. – Fei Han Aug 01 '17 at 08:53