0

in UWP "knownfolders.VideoLibrary", what exact folders does this pickup ? musiclibrary picks all music present on the hard drive, but VideosLibrary seems to pick only 2 folders on my harddrive which have videos. but there are other folders as well and they are not being picked. here is the code.

var files = await KnownFolders.VideosLibrary.GetFilesAsync(
           Windows.Storage.Search.CommonFileQuery.OrderByDate);
kennyzx
  • 12,845
  • 6
  • 39
  • 83
Muhammad Touseef
  • 4,357
  • 4
  • 31
  • 75

1 Answers1

1

Include the other folders into the Video Library.

Right Click a folder containing videos -> Include in library -> video.

You can prompt user to select a folder and add the folder to the video library like this:

StorageLibrary videoLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos);
await videoLibrary.RequestAddFolderAsync();
kennyzx
  • 12,845
  • 6
  • 39
  • 83
  • ok i can do that but how will the user of the app will do it ? I want to access all the video files in their system without asking them, or they dont have to do anything and i just get all video files, isnt that possible ? – Muhammad Touseef Feb 28 '16 at 06:25
  • No, user has full control of what the app can access. You can't scan the whole file system without user's consent. You can user a [FolderPicker](https://msdn.microsoft.com/library/windows/apps/br207881) to prompt user for a folder, so you can search the contents inside that folder. – kennyzx Feb 28 '16 at 06:37
  • thanks man that really helped :) I found a way "RequestAddFolderAsync()" method for the folder picker to add them to library. thanks a lot :) – Muhammad Touseef Feb 28 '16 at 06:57