VB.net code to Get Blob files

Rajnilari2015
Posted by Rajnilari2015 under Azure category on | Points: 40 | Views : 101
The below code will do so
Public Function GetBlobFiles(connectionString As String, containerName As String) As List(Of String)
Dim blobFiles = New List(Of String)()
Dim storageAccount As CloudStorageAccount = CloudStorageAccount.Parse(connectionString)
Dim blobclient As CloudBlobClient = storageAccount.CreateCloudBlobClient()
Dim blobcontainer As CloudBlobContainer = blobclient.GetContainerReference(containerName)
For Each item As IListBlobItem In blobcontainer.ListBlobs(Nothing, False)
If item.[GetType]() = GetType(CloudBlockBlob) Then
Dim blob As CloudBlockBlob = DirectCast(item, CloudBlockBlob)
blobFiles.Add(blob.Name)
End If
Next
Return blobFiles
End Function

Comments or Responses

Login to post response