I'm trying to figure out how to
-or-
using the Azure Storage Client Library for .NET .
The MS docs do give us an API endpoint to hit ... but I'm hoping to use the .NET Storage SDK which handles a lot of the low level communications (authentication, etc) for me.
Can anyone show me what it takes to do this, please?
Please take a look at our File storage sample for some code that shows how to do this.
Snippet:
//***** Get list of all files/directories on the file share*****//
// List all files/directories under the root directory.
Console.WriteLine("Getting list of all files/directories under the root directory of the share.");
IEnumerable<IListFileItem> fileList = cloudFileShare.GetRootDirectoryReference().ListFilesAndDirectories();
// Print all files/directories listed above.
foreach (IListFileItem listItem in fileList)
{
// listItem type will be CloudFile or CloudFileDirectory.
Console.WriteLine(" - {0} (type: {1})", listItem.Uri, listItem.GetType());
}
Console.WriteLine("Getting list of all files/directories in the file directory on the share.");
var directories = fileDirectory.ListFilesAndDirectories().Where(x => x.GetType() ==
typeof(CloudFileDirectory)).Cast<CloudFileDirectory>();
var files = fileDirectory.ListFilesAndDirectories().Where(x => x.GetType() ==
typeof(CloudFile)).Cast<CloudFile>().ToList();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.