I'm trying to fetch all the file names from a Blob Container in Azure storage account.
This is the code I have written to do the same.
string connectionString = "DefaultEndpointsProtocol=https;AccountName=filesStorage;AccountKey=xxxx;EndpointSuffix=core.windows.net";
string containerName = "firstContainer" + "\\" + "secondFolder";
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName);
var blobs = containerClient.GetBlobs();
foreach (var item in blobs)
{
blobFilesList.Add(item.Name);
}
When I run this code , I'm getting an error at foreach statement :
InvalidUriThe requested URI does not represent any resource on the server.
But the connectionstring I'm using is correct. I'm able to login into Azure storage account using this connectionstring.
Can anyone tell me what am I doing wrong here. I searched for similar problems , but I couldn't get any relevant solution for this. Any help is greatly helpful. Many thanks.