I am trying to download a file which is inside a subfolder of a blob container in a storage account using Azure c# function.
BlobUriBuilder blobUriBuilder = new BlobUriBuilder(fileUri);
string containerName = blobUriBuilder.BlobContainerName; string blobName = blobUriBuilder.BlobName;
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString); BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName); BlobClient blobClient = containerClient.GetBlobClient(blobName);
// Check if the document exists if (!await blobClient.ExistsAsync()) { return new NotFoundObjectResult(new { error = "Verify the file name", details = "Unable to locate the file in the provided location" }); }
BlobDownloadInfo download = await blobClient.DownloadAsync();