CommonFileQuery Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies how to sort the files in the query results and determines whether the query is shallow or deep. Query results for deep queries include all files in all of the subfolders of the current folder, sorted according to the specified option.
public enum class CommonFileQuery
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class CommonFileQuery
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum CommonFileQuery
var value = Windows.Storage.Search.CommonFileQuery.defaultQuery
Public Enum CommonFileQuery
- Inheritance
-
CommonFileQuery
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Fields
Name | Value | Description |
---|---|---|
DefaultQuery | 0 | A shallow list of files in the current folder, similar to the list that File Explorer provides. You can use this option for any storage location. |
OrderByName | 1 | A deep, flat list of files in a folder and its subfolders, sorted by System.ItemNameDisplay. You can use this option for any storage location. |
OrderByTitle | 2 | A deep, flat list of files in a folder and its subfolders, sorted by System.Title. You can use this option only for folders in a library or the HomeGroup folder. |
OrderByMusicProperties | 3 | A deep, flat list of files in a folder and its subfolders, sorted by music properties. You can use this option only for folders in a library or the HomeGroup folder. |
OrderBySearchRank | 4 | A deep, flat list of files in a folder and its subfolders, sorted by System.Search.Rank followed by System.DateModified. You can use this option for any storage location. |
OrderByDate | 5 | A deep, flat list of files in a folder and its subfolders, sorted by System.ItemDate. You can use this option only for folders in a library or the HomeGroup folder. Note System.ItemDate is a computed property that changes based on the content type; for example, it maps to System.Photo.DateTaken for photos. |
Remarks
Use a value from the CommonFileQuery enumeration when you call one of the following methods of the StorageFolder class. For examples that use values from the CommonFileQuery enumeration, see the topics for these methods.
- CreateFileQuery(CommonFileQuery)
- CreateFileQueryWithOptions. Instantiate the QueryOptions with the QueryOptions(CommonFileQuery, IIterable(String)) constructor.
- CreateItemQueryWithOptions. Instantiate the QueryOptions with the QueryOptions(CommonFileQuery, IIterable(String)) constructor.
- GetFilesAsync(CommonFileQuery)
- GetFilesAsync(CommonFileQuery, UInt32, UInt32)
These methods use the value from the CommonFileQuery enumeration to initialize the FolderDepth, IndexerOption, and SortOrder options of the query.
Call the StorageFolder.IsCommonFileQuerySupported method to determine whether the CommonFileQuery value that you want to use is available for the current folder.
Tip
Files that don't have a value for the property that the query uses to sort files are typically excluded from query results.