This sample only returns the top level files from a folder:
var myFiles = await tempFolder.GetFilesAsync();
But how do I get the files or folders recursively ?
Here is the javascript answer, which is using QueryOptions, but that’s not an option in C#
IMHO, it’s not that intuitive and kind of confusing that the GetFilesAsync takes a CommonFileQuery enum, but their values not at all suggest their real meaning.
MSDN documents it, but still it can be confusing if you don’t start with reading MSDN for every method.
CommonFileQuery enumeration
These will return top level files only:
While these other enum values will perform a recursive file listing, plus orders the list, so it’s really does 2 things.
Seems like you can only sort the list if you do a recursive (deep) query.
For me it didn’t make much sense to implement it in this ways, hence putting it up here as a Q&A for others.
Something like this could be more useful and intuitive: