StorageFolder.GetFoldersAsync | getFoldersAsync methods

Applies to Windows and Windows Phone

Gets the subfolders in the current folder. Some options also return the contents of nested subfolders, grouped into virtual folders.

Overload list

MethodDescription
GetFoldersAsync() Gets the subfolders in the current folder.
GetFoldersAsync(CommonFolderQuery) Gets the subfolders in the current folder. When the value of the query argument is something other than CommonFolderQuery.DefaultQuery, gets a list of virtual folders that represent containers for groups of files in the subfolders of the current folder. Files are grouped into folders based on the specified value from the CommonFolderQuery enumeration.
GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) Gets an index-based range of folders from the list of all subfolders in the current folder. When the value of the query argument is something other than CommonFolderQuery.DefaultQuery, gets a list of virtual folders that represent containers for groups of files in the subfolders of the current folder. Files are grouped into folders based on the specified value from the CommonFolderQuery enumeration.

Remarks

The following table lists methods of the StorageFolder class that get a list of subfolders. The table identifies shallow queries that only return subfolders from the current folder, and deep queries that return the contents of nested subfolders, grouped into virtual folders.

Some methods take a value from the CommonFolderQuery enumeration.

  • When you use the DefaultQuery option with any folder, the query returns a list of subfolders in the file system.
  • When you use an option other than DefaultQuery with a library folder, the query returns a list of virtual folders that represent containers for files from the subfolders of the current folder. (Files from the current folder are not included.) The files are grouped into virtual folders based on the specified value from the CommonFolderQuery enumeration. For example, if you specify GroupByMonth, the query returns a list of virtual folders such as July 2014, August 2014, and September 2014.

Note  

You can use the DefaultQuery option with any folder; you can use the other options from the CommonFolderQuery enumeration only with library folders, such as the Pictures library, or the Homegroup folder.

To get deep query results from a folder that's not a library folder, call the CreateFolderQueryWithOptions(QueryOptions) method and specify Deep as the value of the FolderDepth property of the QueryOptions object.

MethodCreate a shallow query that only returns subfolders from the current folderCreate a deep query that returns all nested subfolders
GetFoldersAsync() Default behavior of this method.N/a
GetFoldersAsync(CommonFileQuery) Specify the DefaultQuery option.For a library folder, specify an option other than DefaultQuery.
GetFoldersAsync(CommonFileQuery, UInt32, UInt32) Specify the DefaultQuery option.For a library folder, specify an option other than DefaultQuery.
CreateFolderQuery() Default behavior of this method.N/a
CreateFolderQuery(CommonFileQuery) Specify the DefaultQuery option.For a library folder, specify an option other than DefaultQuery.
CreateFolderQueryWithOptions(QueryOptions)
  • Default behavior of this method if none of the following options are specified.

    - or -

  • Specify DefaultQuery as the value of CommonFolderQuery when you instantiate the QueryOptions object.

    - or -

  • Specify Shallow as the value of the FolderDepth property of the QueryOptions object.

 

To get items that are files or folders, call the GetItemsAsync method.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

See also

StorageFolder
GetItemsAsync

 

 

Show:
© 2014 Microsoft