StorageFolder.GetFilesAsync(CommonFileQuery, UInt32, UInt32) | getFilesAsync(CommonFileQuery, UInt32, UInt32) method

Applies to Windows and Windows Phone

Gets an index-based range of files from the list of all files in the current the current folder and its subfolders. Files are sorted based on the specified CommonFileQuery and are included in the range based on their indexes.

Syntax


storageFolder.getFilesAsync(query, startIndex, maxItemsToRetrieve).done( /* Your success and error handlers */ );

Parameters

query

Type: CommonFileQuery

One of the enumeration values that specifies how to sort the files and determines whether the query is shallow or deep.

startIndex

Type: Number [JavaScript] | System.UInt32 [.NET] | uint32 [C++]

The zero-based index of the first file in the range to retrieve.

maxItemsToRetrieve

Type: Number [JavaScript] | System.UInt32 [.NET] | uint32 [C++]

The maximum number of files to retrieve.

Return value

Type: IAsyncOperation<IVectorView>

When this method completes successfully, it returns a list of files sorted as specified by query. The list is of type IReadOnlyList<StorageFile>. Each file in the list is represented by a StorageFile object.

Remarks

Using a CommonFileQuery lets you sort files based on specific file attributes (like title or date) quickly and easily.

For library folders such as the PicturesLibrary, the values from the CommonFileQuery enumeration (except CommonFileQuery.DefaultQuery) return deep query results from the current folder and its subfolders. For folders that aren't library folders, if you want to retrieve items at all levels under the current folder, create a file query by calling the CreateFileQueryWithOptions method. Specify FolderDepth.Deep as the value of the QueryOptions.FolderDepth property.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

See also

StorageFolder
GetFilesAsync(CommonFileQuery)
GetFilesAsync

 

 

Show:
© 2014 Microsoft