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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Loop through share files in Azure Storage Account

(4) ShareShare
ReportReport
Posted on by 20
 
Hi I'm trying to loop through the share files in an azure storage account.
 
Here is my code:
 
the problem is that my code does not compile as the attached image shows:


            var storageCredentials = new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials('filedemostorage', 'abc/==');

            CloudStorageAccount storageAccount = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(storageCredentials, true);

            CloudFileClient fileClient = storageAccount.CreateCloudFileClient();       

            CloudFileShare share = fileClient.GetShareReference('filesharedemo'); 

            CloudFileDirectory directory = share.GetRootDirectoryReference(); 

            System.Collections.IEnumerable lstEnumarable = directory.ListFilesAndDirectories();
 
FileShareError.png
Categories:
I have the same question (0)
  • D365FnOConsultant Profile Picture
    on at
    The errors in the screenshot are about FileRequestOptions and OperationContext which usually happen when C# can’t figure out which method you’re trying to call. Make sure you include the correct namespaces, since, in the legacy Azure Storage SDK (Microsoft.WindowsAzure.Storage.File), file listings are paged, so you should use the segmented async method instead of ListFilesAndDirectories().
  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at
    The error messages says that you need to provide values for the parameters. Both are classes, therefore I'm assuming that simply passing null for them will do the job. Give it a try.
  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at
    The problem isn't that the method couldn't be found. It was, but the system can't apply default values of parameters, therefore it says that you need to pass a literal value for each parameter.
  • D365FnOConsultant Profile Picture
    on at
    I agree with @Martin Dráb, both parameters are reference-type classes, and passing null will treat it as “use defaults” so it should work.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans