locked
PicturesLibrary read issue

    Question

  • Hi,

    I am getting the following error - value does not fall within the expected range - on the below code for variable 'fileList1' but variable 'test1' works fine.

    I have given the app access to the pictures library and it can get to the file 5.jpg which is in the folder (test1)...but when I try and get it to pull back a list of files in the folder (fileList1) then I get the error?

    Can anyone point out what is wrong here?  I have looked all over google and can not see why this is not working.

    Thanks for any help.

    Dim test1 = Await Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync("5.JPG")

    Dim fileList1 = Await Windows.Storage.KnownFolders.PicturesLibrary.GetFilesAsync()





    • Edited by Ireland75 Thursday, January 22, 2015 12:39 PM
    Thursday, January 22, 2015 12:16 PM

Answers

  •   Dim fileList1 = Await Windows.Storage.KnownFolders.PicturesLibrary.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByDate)

    for detail information, see : https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn639127

    KnownFolders.PicturesLibrary.GetFilesAsync() <-- This is flat query
    KnownFolders.PicturesLibrary.GetFilesAsync(CommonFileQuery.OrderByDate) <--This is a shaped deep query


    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    • Marked as answer by Ireland75 Thursday, January 22, 2015 3:29 PM
    Thursday, January 22, 2015 1:43 PM

All replies

  •   Dim fileList1 = Await Windows.Storage.KnownFolders.PicturesLibrary.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByDate)

    for detail information, see : https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn639127

    KnownFolders.PicturesLibrary.GetFilesAsync() <-- This is flat query
    KnownFolders.PicturesLibrary.GetFilesAsync(CommonFileQuery.OrderByDate) <--This is a shaped deep query


    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    • Marked as answer by Ireland75 Thursday, January 22, 2015 3:29 PM
    Thursday, January 22, 2015 1:43 PM
  • Hi Bill,

    Thanks for that...it was good to know about the deep search too.

    By going through this, I discovered I had not set my async function to await when it was called and that all it was.  Should have seen it sooner.

    Thanks for your help.

    Thursday, January 22, 2015 3:29 PM