I am trying to download a file which is inside a subfolder of a blob container in a storage account using Azure c# function.

Tilak Karthik 0 Reputation points
2024-03-06T12:45:23.4966667+00:00

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();

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,004 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,862 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,941 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.