1

I'm trying to access all types of files with a FileOpenPicker and display the picked files in a list with thumbnails.

private void Pick()
{
    FileOpenPicker openPicker = new FileOpenPicker();
    openPicker.ViewMode = PickerViewMode.List;
    openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
    openPicker.FileTypeFilter.Add("*");
    openPicker.PickMultipleFilesAndContinue();
}

This works and opens a view where I can either choose to pick files from "Photos", "One Drive" or "Phone". If I choose "Photos", it opens the familiar image picker where I can select pictures and then call

await storageFile.GetThumbnailAsync(ThumbnailMode.ListView)

for the picked files without problems. If I choose "Phone", it opens a more advanced file explorer. When I choose a file from there (even if I choose one of the same images that work when using "Photos" picker), trying to retrieve the thumbnail throws an exception

System.ArgumentException: Value does not fall within the expected range.

What could be causing this and is there a potential fix?

Ieyasu
  • 49
  • 5
  • 1
    Internally, the items returned by **Photos** are backed by a database that has extra metadata, but the **Phone** ones are not (even if you pick the same file). That is the "why." Sadly I don't know the "how" other than to catch the exception. (I had thought maybe the `Path` or `FolderRelativeId` properties would have a clue, but they don't - you could try checking other properties to see if there's a clear difference). – Peter Torr - MSFT Jun 06 '15 at 20:52
  • Thanks for the answer. I'll try to find an alternative strategy. Maybe copying the files temporarily to the local folder and retrieving them from there will work. – Ieyasu Jun 08 '15 at 01:12

0 Answers0