web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Get all the file names in List from blob container in Dynamics 365 finance and operations

Jayaprakash Reddy Profile Picture Jayaprakash Reddy 270

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.

Comments

*This post is locked for comments