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?
Asked
Active
Viewed 1,346 times
1
-
1Please paste your code to get better help. – Muhammad Hassan Apr 12 '16 at 09:58
-
show us minimal compilable example you tried – Ehsan Sajjad Apr 12 '16 at 10:01
-
do you want to read file from local storage or your project folder? – Kinjan Bhavsar Apr 12 '16 at 10:14
-
1You 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 Apr 12 '16 at 10:35
-
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 Apr 12 '16 at 10:42
-
Is there any alternate way this can be achieved? – shagufta syed Apr 12 '16 at 10:55
-
Using Directory.GetFiles method can get the folder/file in the local folder of the Application, but can not open "D:\Personal" file. – Grace Feng Apr 13 '16 at 08:20
1 Answers
1
We cannot access any local storage without user interaction. However, we can access known folders by adding capabilities in app manifest and adding declaration for file type associations.

shagufta syed
- 441
- 6
- 23