Windows.Storage.StorageFolder.CreateItemQueryWithOptions

August 18, 2021 ยท View on GitHub

-description

Gets a query result object that contains the files and subfolders in the current folder and, optionally, in the subfolders of the current folder. The results are based on the specified QueryOptions.

-parameters

-param queryOptions

The criteria that are applied to the query.

-returns

A query result object. Call the GetItemsAsync method of the query result to get the files and subfolders in the current folder and, optionally, in the subfolders of the current folder, filtered and sorted based on the specified QueryOptions. This method returns a list of type IReadOnlyList<IStorageItem>. Each file or folder is represented by an item of type IStorageItem.

To work with the returned items, call the IsOfType method of the IStorageItem interface to determine whether each item is a file or a folder. Then cast the item to a StorageFolder or StorageFile.

-exceptions

T:System.UnauthorizedAccessException

You don't have permission to access the contents of the current folder.

T:System.ArgumentException

You specified a value other than DefaultQuery from the CommonFileQuery or CommonFolderQuery enumeration for a folder that's not a library folder.

-remarks

For more information and examples on getting query result objects, see CreateFileQueryWithOptions.

-examples

-see-also