I need a recursive list of all files and folders at a path. However, in UWP only these (Windows 10 Universal App File/Directory Access) files and folders can be accessed and I dont want the user to pick a file. So I tried using Directory.GetFiles method and this is not returning any file names without giving any error. Does this method work at all in UWP?
1
votes
Please paste your code to get better help.
– Muhammad Hassan
show us minimal compilable example you tried
– Ehsan Sajjad
do you want to read file from local storage or your project folder?
– Kinjan Bhavsar
You can only access the directories that you asked for in the appxmanifest. Which is quite restricted, most likely outcome of arbitrarily trying to access the file system with the Directory class is an undebuggable exception when the sandbox denies access. Enable unmanaged debugging to see it at all, the exception code is 0xC000027B. Decent error reporting is UWP's achilles heel.
– Hans Passant
string FolderPath = @"D:\Personal"; string[] FileNames = Directory.GetFiles(FolderPath); This is what I was trying...I am trying to get all file/folder names from a path at local storage....Enabled unmanaged debugging but I do not get any exception.
– shagufta syed