Skip to content

Latest commit

 

History

History
78 lines (45 loc) · 4 KB

commonfilequery.md

File metadata and controls

78 lines (45 loc) · 4 KB
-api-id -api-type
T:Windows.Storage.Search.CommonFileQuery
winrt enum

CommonFileQuery

-description

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.

-enum-fields

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

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

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

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

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

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

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.

-examples

-see-also

Folder enumeration sample (Windows 10)