IStorageFolderQueryOperations IStorageFolderQueryOperations IStorageFolderQueryOperations IStorageFolderQueryOperations Interface

Definition

Provides methods to create search queries and retrieve files from a folder. This interface is implemented by StorageFolder objects, which can represent file system folders, libraries, or virtual folders that are automatically generated when queries are created using group-based CommonFolderQuery values like GroupByAlbum.

public interface IStorageFolderQueryOperationspublic interface IStorageFolderQueryOperationsPublic Interface IStorageFolderQueryOperationspublic interface IStorageFolderQueryOperations
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions)

Verifies whether the folder supports the specified search query options (returns true or false).

public bool AreQueryOptionsSupported(QueryOptions queryOptions)public bool AreQueryOptionsSupported(QueryOptions queryOptions)Public Function AreQueryOptionsSupported(queryOptions As QueryOptions) As boolpublic bool AreQueryOptionsSupported(QueryOptions queryOptions)
Parameters
queryOptions
QueryOptions QueryOptions QueryOptions QueryOptions

The search query options to test.

Returns
bool bool bool bool

True if the folder supports the specified search query options; otherwise false.

Attributes

Remarks

Not all locations support all query options. Because folders can be retrieved by the picker and you can't control the location, you can use this method to determine whether the location supports a particular query option.

Folders in a library or the HomeGroup support all query options. Other locations only support the following options:

CreateFileQuery() CreateFileQuery() CreateFileQuery() CreateFileQuery()

Retrieves an object for enumerating the files in a storage location and subscribing to events that fire when the contents of the storage location change.

public StorageFileQueryResult CreateFileQuery()public StorageFileQueryResult CreateFileQuery()Public Function CreateFileQuery() As StorageFileQueryResultpublic StorageFileQueryResult CreateFileQuery()
Returns

An object for enumerating files and subscribing to events.

Attributes

CreateFileQuery(CommonFileQuery) CreateFileQuery(CommonFileQuery) CreateFileQuery(CommonFileQuery) CreateFileQuery(CommonFileQuery)

Retrieves an object with the specified options for enumerating the storage location in a folder and subscribing to events that fire when the contents of the storage location change.

public StorageFileQueryResult CreateFileQuery(CommonFileQuery query)public StorageFileQueryResult CreateFileQuery(CommonFileQuery query)Public Function CreateFileQuery(query As CommonFileQuery) As StorageFileQueryResultpublic StorageFileQueryResult CreateFileQuery(CommonFileQuery query)
Parameters
query
CommonFileQuery CommonFileQuery CommonFileQuery CommonFileQuery

The type of folder query to perform. This parameter defaults to CommonFileQuery.DefaultQuery.

Returns

An object for enumerating files and subscribing to events.

Attributes

CreateFileQueryWithOptions(QueryOptions) CreateFileQueryWithOptions(QueryOptions) CreateFileQueryWithOptions(QueryOptions) CreateFileQueryWithOptions(QueryOptions)

Retrieves an object with the specified options for enumerating the files in a storage location and subscribing to events that fire when the contents of the storage location change.

public StorageFileQueryResult CreateFileQueryWithOptions(QueryOptions queryOptions)public StorageFileQueryResult CreateFileQueryWithOptions(QueryOptions queryOptions)Public Function CreateFileQueryWithOptions(queryOptions As QueryOptions) As StorageFileQueryResultpublic StorageFileQueryResult CreateFileQueryWithOptions(QueryOptions queryOptions)
Parameters
queryOptions
QueryOptions QueryOptions QueryOptions QueryOptions

The options for filtering the query results.

Returns

An object for enumerating files and subscribing to events.

Attributes

CreateFolderQuery() CreateFolderQuery() CreateFolderQuery() CreateFolderQuery()

Retrieves an object for enumerating folders in a storage location and subscribing to events that fire when the contents of the storage location change.

public StorageFolderQueryResult CreateFolderQuery()public StorageFolderQueryResult CreateFolderQuery()Public Function CreateFolderQuery() As StorageFolderQueryResultpublic StorageFolderQueryResult CreateFolderQuery()
Returns

An object for enumerating folders and subscribing to events.

Attributes

CreateFolderQuery(CommonFolderQuery) CreateFolderQuery(CommonFolderQuery) CreateFolderQuery(CommonFolderQuery) CreateFolderQuery(CommonFolderQuery)

Retrieves an object with the specified options for enumerating folders in a storage location and subscribing to events that fire when the contents of the storage location change.

public StorageFolderQueryResult CreateFolderQuery(CommonFolderQuery query)public StorageFolderQueryResult CreateFolderQuery(CommonFolderQuery query)Public Function CreateFolderQuery(query As CommonFolderQuery) As StorageFolderQueryResultpublic StorageFolderQueryResult CreateFolderQuery(CommonFolderQuery query)
Parameters
query
CommonFolderQuery CommonFolderQuery CommonFolderQuery CommonFolderQuery

The type of folder query to perform. This parameter defaults to CommonFolderQuery.DefaultQuery.

Returns

An object for enumerating folders and subscribing to events.

Attributes

CreateFolderQueryWithOptions(QueryOptions) CreateFolderQueryWithOptions(QueryOptions) CreateFolderQueryWithOptions(QueryOptions) CreateFolderQueryWithOptions(QueryOptions)

Retrieves an object with the specified options for enumerating folders in a storage location and subscribing to events that fire when the contents of the storage location change.

public StorageFolderQueryResult CreateFolderQueryWithOptions(QueryOptions queryOptions)public StorageFolderQueryResult CreateFolderQueryWithOptions(QueryOptions queryOptions)Public Function CreateFolderQueryWithOptions(queryOptions As QueryOptions) As StorageFolderQueryResultpublic StorageFolderQueryResult CreateFolderQueryWithOptions(QueryOptions queryOptions)
Parameters
queryOptions
QueryOptions QueryOptions QueryOptions QueryOptions

The options for filtering the query results.

Returns

An object for enumerating folders and subscribing to events.

Attributes

Remarks

You can use QueryOptions and CreateFileQueryWithOptions to create an indexed backed file query that lets you get properties that rely on another app's property handler. For more information see QueryOptions.

CreateItemQuery() CreateItemQuery() CreateItemQuery() CreateItemQuery()

Retrieves an object for performing shallow enumerations of the files and folders in a storage location. An app can use the object to enumerate the items in a storage location and subscribe to events that fire when the contents of the storage location change.

public StorageItemQueryResult CreateItemQuery()public StorageItemQueryResult CreateItemQuery()Public Function CreateItemQuery() As StorageItemQueryResultpublic StorageItemQueryResult CreateItemQuery()
Returns

An object for enumerating storage items and subscribing to events.

Attributes

CreateItemQueryWithOptions(QueryOptions) CreateItemQueryWithOptions(QueryOptions) CreateItemQueryWithOptions(QueryOptions) CreateItemQueryWithOptions(QueryOptions)

Retrieves an object with the specified options for enumerating the files and folders in a storage location and subscribing to events that fire when the contents of the storage location change.

public StorageItemQueryResult CreateItemQueryWithOptions(QueryOptions queryOptions)public StorageItemQueryResult CreateItemQueryWithOptions(QueryOptions queryOptions)Public Function CreateItemQueryWithOptions(queryOptions As QueryOptions) As StorageItemQueryResultpublic StorageItemQueryResult CreateItemQueryWithOptions(QueryOptions queryOptions)
Parameters
queryOptions
QueryOptions QueryOptions QueryOptions QueryOptions

The options for filtering the query results.

Returns

An object for enumerating storage items and subscribing to events.

Attributes

Remarks

Don't set QueryOptions.FolderDepth to FolderDepth.Deep; deep queries do not work if you are querying files in a Digital Living Network Alliance (DLNA) device.

GetFilesAsync(CommonFileQuery) GetFilesAsync(CommonFileQuery) GetFilesAsync(CommonFileQuery) GetFilesAsync(CommonFileQuery)

Retrieves a list of files based on the specified query (shallow enumeration). This returns a snapshot of the files at a point in time and does not allow you to keep track of changes through events.

public IAsyncOperation<IVectorView<StorageFile>> GetFilesAsync(CommonFileQuery query)public IAsyncOperation<IVectorView<StorageFile>> GetFilesAsync(CommonFileQuery query)Public Function GetFilesAsync(query As CommonFileQuery) As IAsyncOperation( Of IVectorViewStorageFile )public IAsyncOperation<IVectorView<StorageFile>> GetFilesAsync(CommonFileQuery query)
Parameters
query
CommonFileQuery CommonFileQuery CommonFileQuery CommonFileQuery

The type of file query to perform.

Returns

When this method completes successfully, it returns a list (type IVectorView ) of files that are represented by StorageFile objects.

Attributes

GetFilesAsync(CommonFileQuery, UInt32, UInt32) GetFilesAsync(CommonFileQuery, UInt32, UInt32) GetFilesAsync(CommonFileQuery, UInt32, UInt32) GetFilesAsync(CommonFileQuery, UInt32, UInt32)

Retrieves a list of files in a specified range that are based on the specified file query. This returns a snapshot of the files at a point in time and does not allow you to keep track of changes through events.

public IAsyncOperation<IVectorView<StorageFile>> GetFilesAsync(CommonFileQuery query, UInt32 startIndex, UInt32 maxItemsToRetrieve)public IAsyncOperation<IVectorView<StorageFile>> GetFilesAsync(CommonFileQuery query, UInt32 startIndex, UInt32 maxItemsToRetrieve)Public Function GetFilesAsync(query As CommonFileQuery, startIndex As UInt32, maxItemsToRetrieve As UInt32) As IAsyncOperation( Of IVectorViewStorageFile )public IAsyncOperation<IVectorView<StorageFile>> GetFilesAsync(CommonFileQuery query, UInt32 startIndex, UInt32 maxItemsToRetrieve)
Parameters
query
CommonFileQuery CommonFileQuery CommonFileQuery CommonFileQuery

The type of file query to perform.

startIndex
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The zero-based index of the first file in the range. This parameter defaults to 0.

maxItemsToRetrieve
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The maximum number of files to retrieve. Use -1 to retrieve all files.

Returns

When this method completes successfully, it returns a list (type IVectorView ) of files that are represented by StorageFile objects.

Attributes

Remarks

Use this overload to retrieve improve system performance by presenting a virtual view of the query results that includes only the necessary subset of files.

GetFoldersAsync(CommonFolderQuery) GetFoldersAsync(CommonFolderQuery) GetFoldersAsync(CommonFolderQuery) GetFoldersAsync(CommonFolderQuery)

Retrieves a list of folders and file groups based on a specified folder query. This returns a snapshot of the folders or file groups at a point in time and does not allow you to keep track of changes through events.

public IAsyncOperation<IVectorView<StorageFolder>> GetFoldersAsync(CommonFolderQuery query)public IAsyncOperation<IVectorView<StorageFolder>> GetFoldersAsync(CommonFolderQuery query)Public Function GetFoldersAsync(query As CommonFolderQuery) As IAsyncOperation( Of IVectorViewStorageFolder )public IAsyncOperation<IVectorView<StorageFolder>> GetFoldersAsync(CommonFolderQuery query)
Parameters
query
CommonFolderQuery CommonFolderQuery CommonFolderQuery CommonFolderQuery

The type of folder query to perform.

Returns

When this method completes successfully, it returns a list (type IVectorView ) of folders of file groups that are represented by StorageFolder objects.

Attributes

GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) GetFoldersAsync(CommonFolderQuery, UInt32, UInt32)

Asynchronously retrieves a range of folders in this folder based on a folder query. This returns a snapshot of the folders or file groups at a point in time and does not allow you to keep track of changes through events.

public IAsyncOperation<IVectorView<StorageFolder>> GetFoldersAsync(CommonFolderQuery query, UInt32 startIndex, UInt32 maxItemsToRetrieve)public IAsyncOperation<IVectorView<StorageFolder>> GetFoldersAsync(CommonFolderQuery query, UInt32 startIndex, UInt32 maxItemsToRetrieve)Public Function GetFoldersAsync(query As CommonFolderQuery, startIndex As UInt32, maxItemsToRetrieve As UInt32) As IAsyncOperation( Of IVectorViewStorageFolder )public IAsyncOperation<IVectorView<StorageFolder>> GetFoldersAsync(CommonFolderQuery query, UInt32 startIndex, UInt32 maxItemsToRetrieve)
Parameters
query
CommonFolderQuery CommonFolderQuery CommonFolderQuery CommonFolderQuery

The type of folder query to perform.

startIndex
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The zero-based index of the first folder or file group in the range. This parameter defaults to 0.

maxItemsToRetrieve
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The maximum number of folders or file groups to retrieve. Use -1 to retrieve all folders or file groups.

Returns

When this method completes successfully, it returns a list (type IVectorView ) of folders of file groups that are represented by StorageFolder objects.

Attributes

Remarks

Use this overload to retrieve improve system performance by presenting a virtual view of the query results that includes only the necessary subset of folders.

GetIndexedStateAsync() GetIndexedStateAsync() GetIndexedStateAsync() GetIndexedStateAsync()

Retrieves a value that indicates the indexed state of the StorageFolder location associated with the query.

public IAsyncOperation<IndexedState> GetIndexedStateAsync()public IAsyncOperation<IndexedState> GetIndexedStateAsync()Public Function GetIndexedStateAsync() As IAsyncOperation( Of IndexedState )public IAsyncOperation<IndexedState> GetIndexedStateAsync()
Returns

When this method completes successfully, it returns a value of the IndexedState enumeration.

Attributes

GetItemsAsync(UInt32, UInt32) GetItemsAsync(UInt32, UInt32) GetItemsAsync(UInt32, UInt32) GetItemsAsync(UInt32, UInt32)

Retrieves a list items like files, folders, or file groups, in a specified range (shallow enumeration).

public IAsyncOperation<IVectorView<IStorageItem>> GetItemsAsync(UInt32 startIndex, UInt32 maxItemsToRetrieve)public IAsyncOperation<IVectorView<IStorageItem>> GetItemsAsync(UInt32 startIndex, UInt32 maxItemsToRetrieve)Public Function GetItemsAsync(startIndex As UInt32, maxItemsToRetrieve As UInt32) As IAsyncOperation( Of IVectorViewIStorageItem )public IAsyncOperation<IVectorView<IStorageItem>> GetItemsAsync(UInt32 startIndex, UInt32 maxItemsToRetrieve)
Parameters
startIndex
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The zero-based index of the first item in the range. This parameter defaults to 0.

maxItemsToRetrieve
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The maximum number of items to retrieve. Use -1 to retrieve all items.

Returns

When this method completes successfully, it returns a list (type IVectorView ) of items. Each item is the IStorageItem type and represents a file, folder, or file group.

In this list, files are represented by StorageFile objects, and folders or file groups are represented by StorageFolder objects.

Attributes

IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery)

Verifies whether this folder supports the specified file query (returns true or false).

public bool IsCommonFileQuerySupported(CommonFileQuery query)public bool IsCommonFileQuerySupported(CommonFileQuery query)Public Function IsCommonFileQuerySupported(query As CommonFileQuery) As boolpublic bool IsCommonFileQuerySupported(CommonFileQuery query)
Parameters
Returns
bool bool bool bool

True if the folder supports the specified file query; otherwise false.

Attributes

Remarks

Not all locations support all query options. Because files can be retrieved by the picker and you can't control the location, you can use this method to determine whether the location supports a particular query option.

Folders in a library or the HomeGroup support all query options. Other locations only support the following options:

IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery)

Verifies whether this folder supports the specified folder query (returns true or false).

public bool IsCommonFolderQuerySupported(CommonFolderQuery query)public bool IsCommonFolderQuerySupported(CommonFolderQuery query)Public Function IsCommonFolderQuerySupported(query As CommonFolderQuery) As boolpublic bool IsCommonFolderQuerySupported(CommonFolderQuery query)
Parameters
Returns
bool bool bool bool

True if the folder supports the specified folder query; otherwise false.

Attributes

Remarks

Not all locations support all query options, for more detail refer to IsCommonFileQuerySupported.