C# code to delete a file from blob

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

public void DeleteFromBlob(string filename, string connectionString, string containerName)
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference(containerName);

// Retrieve reference to a blob named "myblob.csv".
CloudBlockBlob blockBlob = container.GetBlockBlobReference(filename);

// Delete the blob.

Comments or Responses

Login to post response