VB.net code to delete a file from blob

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

Public Sub DeleteFromBlob(filename As String, connectionString As String, containerName As String)
' Retrieve storage account from connection string.
Dim storageAccount As CloudStorageAccount = CloudStorageAccount.Parse(connectionString)

' Create the blob client.
Dim blobClient As CloudBlobClient = storageAccount.CreateCloudBlobClient()

' Retrieve reference to a previously created container.
Dim container As CloudBlobContainer = blobClient.GetContainerReference(containerName)

' Retrieve reference to a blob named "myblob.csv".
Dim blockBlob As CloudBlockBlob = container.GetBlockBlobReference(filename)

' Delete the blob.
blockBlob.Delete()
End Sub

Comments or Responses

Login to post response