Issues with Windows 10 release

I am trying to follow instructions to get files from known folders in windows 10 like below,

https://msdn.microsoft.com/en-us/library/windows/apps/br227275.aspx

            try
            {
                StorageFolder folder = KnownFolders.PicturesLibrary;
                IReadOnlyList<StorageFile> pics = await folder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByDate, 0, 20);
                Debug.WriteLine(pics.Count);
            }

            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

      

The same code works in the WindowsPhone 8.1 SDK. But this is not the case on Windows 10 mobile. The exception I get is this,

The specified query parameters are not available for this folder because it is not in the library or homegroup. Only folders in the Library or Homegroup support all options.

Any ideas on how to fix this?

+3
c # windows-8.1 windows-10 windows-phone windows-phone-8.1


source to share


4 answers


Windows 10 is still working. The last phone issue solved this problem.



+1


source to share


Windows 10 Mobile is the same for Windows 10 desktop. Sample code from MSDN:



Try using the code you have without the try catch block. Also, keep in mind that this uses asynchronous programming techniques.

-1


source to share


You need to provide a library of image access capabilities and link information to it.

Go to your application's Solution Explorer -> then "Package.appxmanifest" -> then "Features" -> Select "Image Library" (if not selected, select it).

After restoring your project, you should be able to run your code successfully. Hope this helps you :-)

-1


source to share


Updated answer, below code works, its tested

StorageFolder folder = KnownFolders.PicturesLibrary;
StorageFileQueryResult query = folder.CreateFileQuery(Windows.Storage.Search.CommonFileQuery.OrderByDate);
IReadOnlyList<StorageFile> pics = await query.GetFilesAsync(0, 20);
Debug.WriteLine(pics.Count);

      

there is an example for getting requests for folders on MSDN, applies the same for file requests https://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj150593.ASP

-1


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics