Reputation: 4332
I need some help on File and Folders operations.
I need to retrieve a file in subfolder in a main Folder in the Document Library.
Let say, I create the following folder and subfolder in Documents Folder:
Is Document Library Folder refer to the Documents Folder in C-drive?
How to I retrieve the file in the Subfolder ?
Below is my current code, how to start from here?
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFile sampleFile = await storageFolder.GetFileAsync("myfile.txt");
Upvotes: 1
Views: 379
Reputation: 10015
KnownFolders.DocumentsLibrary
references normally to %USERPROFILE%\Documents
(see MSDN).
You have to load each subfolder before being able to access the file.
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFolder mainFolder = await storageFolder.GetFolderAsync("MyWorkShop");
StorageFolder subFolder = await mainFolder.GetFolderAsync("2016-08-10");
StorageFile sampleFile = await subFolder.GetFileAsync("myfile.txt");
Upvotes: 1