Skip to content

Latest commit

 

History

History
119 lines (65 loc) · 8.21 KB

commonfolderquery.md

File metadata and controls

119 lines (65 loc) · 8.21 KB
-api-id -api-type
T:Windows.Storage.Search.CommonFolderQuery
winrt enum

CommonFolderQuery

-description

Specifies how to group files into folders 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, grouped into folders according to the specified option.

-enum-fields

-field DefaultQuery:0

A shallow list of the folders in the current folder, similar to the view that File Explorer provides.

You can use this option for any storage location.

-field GroupByYear:100

Group files into virtual folders by year based on the System.ItemDate property of each file. Each folder will contain all (and only) files that have values for System.ItemDate within the same year.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByMonth:101

Group files into virtual folders by month based on the System.ItemDate property of each file. Each folder will contain all (and only) files that have values for System.ItemDate within the same month.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByArtist:102

Group files into virtual folders based on the System.Music.Artist property of each file. Each folder will contain all (and only) files with identical values for System.Music.Artist.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByAlbum:103

Group files into virtual folders by year based on the System.Music.AlbumTitle property of each file. Each folder will contain all (and only) files with identical values for System.Music.AlbumTitle.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByAlbumArtist:104

Group files into virtual folders based on the System.Music.AlbumArtist property of each file. Each folder will contain all (and only) files with identical values for System.Music.AlbumArtist.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByComposer:105

Group files into virtual folders based on the System.Music.Composer property of each file. Each folder will represent one composer, and contain all files whose System.Music.Composer vector contains that composer. If a file lists multiple composers, it may appear in more than one of the resulting folders.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByGenre:106

Group files into virtual folders based on the System.Music.Genre property of each file. Each folder will contain all (and only) files with identical values for System.Music.Genre.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByPublishedYear:107

Group files into virtual folders by year based on the System.Media.Year property of each file. Each folder will contain all (and only) files that have values for System.Media.Year within the same year.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByRating:108

Group files into virtual folders by rating (1 star, 2 stars, and so on) based on the System.Rating property of each file. Each folder will contain all (and only) files with identical values for System.Rating.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByTag:109

Group files into virtual folders based on the System.Keywords property of each file. Each folder will represent one tag, and contain all files whose System.Keywords vector contains that tag. If a file lists multiple tags in its System.Keywords vector, it may appear in more than one of the resulting folders.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByAuthor:110

Group files into virtual folders based on the System.Author property of each file. Each folder will represent one author, and contain all files whose System.Author vector contains that author. If a file lists multiple authors, it may appear in more than one of the resulting folders.

You can use this option only for folders in a library or the HomeGroup folder.

-field GroupByType:111

Group files into virtual folders by type (for example, Microsoft Word documents, text files, and so forth) based on the System.ItemTypeText property of each file.

You can use this option only for folders in a library or the HomeGroup folder.

-remarks

Use a value from the CommonFolderQuery enumeration when you call one of the following methods of the StorageFolder class. For examples that use values from the CommonFolderQuery enumeration, see the topics for these methods.

These methods use the value from the CommonFolderQuery enumeration to initialize the DateStackOption, FolderDepth, IndexerOption, and SortOrder options of the query.

Call the StorageFolder.IsCommonFolderQuerySupported method to determine whether the CommonFolderQuery value that you want to use is available for the current folder.

[!TIP] When a query groups files into virtual folders based on a property that can have multiple values (for example, System.Author), a particular file may appear in more than one virtual folder because each folder represents one of the multiple values.

Files that don't have a value for the property that the query uses to group files are typically excluded from query results.

-examples

-see-also

queryOptions class, Windows.Storage.storageFolder class, Folder enumeration sample (Windows 10)