StorageFolder.CreateItemQueryWithOptions(QueryOptions) Method

Definition

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.

public:
 virtual StorageItemQueryResult ^ CreateItemQueryWithOptions(QueryOptions ^ queryOptions) = CreateItemQueryWithOptions;
StorageItemQueryResult CreateItemQueryWithOptions(QueryOptions const& queryOptions);
public StorageItemQueryResult CreateItemQueryWithOptions(QueryOptions queryOptions);
function createItemQueryWithOptions(queryOptions)
Public Function CreateItemQueryWithOptions (queryOptions As QueryOptions) As StorageItemQueryResult

Parameters

queryOptions
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.

Implements

Exceptions

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

You specified a value other than DefaultQuery from the <xref:Windows.Storage.Search.CommonFileQuery?text=CommonFileQuery> or <xref:Windows.Storage.Search.CommonFolderQuery?text=CommonFolderQuery> enumeration for a folder that's not a library folder.

Remarks

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

Applies to