Get all the file names in List from blob container in Dynamics 365 finance and operations
Views (30)
The below code help you to loop through all the files and in blob storage and get their names.
public static list getFileNamesFromBlob(CloudBlobContainer _blobContainer, str _filepath)
{
CloudBlobDirectory cloudBlobDirectory;
container con;
cloudBlobDirectory = _blobContainer.GetDirectoryReference(_filepath);
System.Collections.IEnumerable lstEnumarable = cloudBlobDirectory.ListBlobs(false, 0, null, null);
System.Collections.IEnumerator lstEnumarator = lstEnumarable.GetEnumerator();
List filenames = new List(Types::String);
while(lstEnumarator.MoveNext())
{
IListBlobItem item = lstEnumarator.Current;
if(item is CloudBlockBlob)
{
CloudBlockBlob blob = item;
blob.FetchAttributes(null, null, null);
con = str2con(blob.name, '/');
filenames.addStart(conPeek(con,conlen(con)));
}
}
return filenames;
}
Hope this helps and I will come up with another interesting blog post.

Like
Report
*This post is locked for comments