FilePickerSelectedFilesArray class

FilePickerSelectedFilesArray class

Represents a collection of storage files that the user has selected by using a file picker.


/* For information about creating or accessing this object, see Remarks. */


The FilePickerSelectedFilesArray class has these types of members:


The FilePickerSelectedFilesArray class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

First [C++, JavaScript]Retrieves an iterator that iterates through the collection of StorageFile objects that represent selected files.
GetAt [C++, JavaScript]Returns the StorageFile object at the specified index in the collection.
GetMany [C++, JavaScript]Retrieves the StorageFile objects that start at the specified index in the collection.
IndexOf [C++, JavaScript]Retrieves the index of a specified StorageFile object in the collection.



The FilePickerSelectedFilesArray class has these properties.

PropertyAccess typeDescription

Count [C#, VB]


Gets the number of elements contained in the collection.

Item [C#, VB]


Gets or sets the element at the specified index.

Size [C++, JavaScript]


Gets the number of StorageFile objects in the collection.



When a call to the fileOpenPicker.pickMultipleFilesAsync method completes successfully, it returns a filePickerSelectedFilesArray object that contains all the files that were picked by the user. Picked files in this array are represented by storageFile objects.

Collection member lists

For JavaScript, FilePickerSelectedFilesArray has the members shown in the member lists. In addition, FilePickerSelectedFilesArray supports a length property, members of Array.prototype, and using an index to access items.

Enumerating the collection in C# or Microsoft Visual Basic

FilePickerSelectedFilesArray is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<StorageFile> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable<T> with a StorageFile constraint.


The File picker sample demonstrates how capture the filePickerSelectedFilesArray (files in the example) of picked files after calling fileOpenPicker.pickMultipleFilesAsync.

Note  You should always make sure that your app is not snapped (or that it can be unsnapped) and set file picker properties regardless of whether the user is picking a single file or multiple files.

openPicker.pickMultipleFilesAsync().then(function (files) {
    if (files.size > 0) {
        // Application now has read/write access to the picked file(s)
        var outputString = "Picked files:\n";
        for (var i = 0; i < files.size; i++) {
            outputString = outputString + files[i].name + "\n";
        WinJS.log && WinJS.log(outputString, "sample", "status");
    } else {
        // The picker was dismissed with no selected file
        WinJS.log && WinJS.log("Operation cancelled.", "sample", "status");

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Storage::Pickers [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Storage::Pickers [C++]





See also

File picker sample
Quickstart: Accessing files with file pickers
fileOpenPicker.pickMultipleFilesAsync method



© 2016 Microsoft