StorageFolder Class

Definition

Manages folders and their contents and provides information about them.

public ref class StorageFolder sealed : IStorageFolder, IStorageFolder2, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class StorageFolder final : IStorageFolder, IStorageFolder2, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class StorageFolder : IStorageFolder, IStorageFolder2, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
Public NotInheritable Class StorageFolder
Implements IStorageFolder, IStorageFolder2, IStorageFolderQueryOperations, IStorageItem2, IStorageItemProperties2, IStorageItemPropertiesWithProvider
Inheritance
Object Platform::Object IInspectable StorageFolder
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
documentsLibrary musicLibrary picturesLibrary videosLibrary

Remarks

Typically you get StorageFolder objects as the return value of asynchronous method calls. For example, the static method GetFolderFromPathAsync returns a StorageFolder that represents the specified folder.

Note that when you call a file picker to let the user pick a folder, the file picker returns the folder as a StorageFolder.

There is not currently a "MoveAsync" or similar method. One simple implementation of moving a folder might be to get the desired folder, copy it to the desired location, and then delete the original folder.

Version history

Windows version SDK version Value added
1803 17134 TryGetChangeTracker
2004 19041 GetFolderFromPathForUserAsync

Properties

Attributes

Gets the attributes of the current folder.

DateCreated

Gets the date and time that the current folder was created.

DisplayName

Gets the user-friendly name of the current folder.

DisplayType

Gets the user-friendly description of the type of the folder; for example, JPEG image.

FolderRelativeId

Gets an identifier for the current folder. This ID is unique for the query result or StorageFolder that contains the current folder or file group, and can be used to distinguish between items that have the same name.

Name

Gets the name of the current folder.

Path

Gets the full path of the current folder in the file system, if the path is available.

Properties

Gets an object that provides access to the content-related properties of the current folder.

Provider

Gets the StorageProvider object that contains info about the service that stores the current folder.

Methods

AreQueryOptionsSupported(QueryOptions)

Indicates whether the current folder supports the specified QueryOptions.

CreateFileAsync(String, CreationCollisionOption)

Creates a new file in the current folder. This method also specifies what to do if a file with the same name already exists in the current folder.

CreateFileAsync(String)

Creates a new file with the specified name in the current folder.

CreateFileQuery()

Gets a query result object that contains the files in the current folder.

CreateFileQuery(CommonFileQuery)

Gets a query result object that contains the files in the current folder. Also gets the files from the subfolders of the current folder when the value of the query argument is something other than CommonFileQuery.DefaultQuery. Files are sorted based on the specified CommonFileQuery.

CreateFileQueryWithOptions(QueryOptions)

Gets a query result object that contains the files in the current folder and, optionally, in the subfolders of the current folder. The results are based on the specified QueryOptions.

CreateFolderAsync(String, CreationCollisionOption)

Creates a new subfolder with the specified name in the current folder. This method also specifies what to do if a subfolder with the same name already exists in the current folder.

CreateFolderAsync(String)

Creates a new subfolder with the specified name in the current folder.

CreateFolderQuery()

Gets a query result object that contains the subfolders in the current folder.

CreateFolderQuery(CommonFolderQuery)

Gets a query result object that contains 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.

CreateFolderQueryWithOptions(QueryOptions)

Gets a query result object that contains the subfolders in the current folder and, optionally, nested subfolders. The results are based on the specified QueryOptions.

CreateItemQuery()

Gets a query result object that contains the files and subfolders in the current folder.

CreateItemQueryWithOptions(QueryOptions)

Gets a query result object that contains the files and subfolders in the current folder and, optionally, in the subfolders of the current folder. The results are based on the specified QueryOptions.

DeleteAsync()

Deletes the current folder.

DeleteAsync(StorageDeleteOption)

Deletes the current folder. This method also specifies whether to delete the folder permanently.

GetBasicPropertiesAsync()

Gets the basic properties of the current folder or file group.

GetFileAsync(String)

Gets the file with the specified name from the current folder.

GetFilesAsync()

Gets the files in the current folder.

GetFilesAsync(CommonFileQuery, UInt32, UInt32)

Gets an index-based range of files from the list of all files in the current folder. Also gets the files from the subfolders of the current folder when the value of the query argument is something other than CommonFileQuery.DefaultQuery. Files are sorted based on the specified value from the CommonFileQuery enumeration.

GetFilesAsync(CommonFileQuery)

Gets the files in the current folder. Also gets the files from the subfolders of the current folder when the value of the query argument is something other than CommonFileQuery.DefaultQuery. Files are sorted based on the specified value from the CommonFileQuery enumeration.

GetFolderAsync(String)

Gets the subfolder with the specified name from the current folder.

GetFolderFromPathAsync(String)

Gets the folder that has the specified absolute path in the file system.

GetFolderFromPathForUserAsync(User, String)

Gets the StorageFolder based on an absolute path in the file system for a given user.

GetFoldersAsync()

Gets the subfolders in the current folder.

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.

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.

GetIndexedStateAsync()

Gets the indexed state of the current folder.

GetItemAsync(String)

Gets the file or folder with the specified name from the current folder.

GetItemsAsync()

Gets the files and subfolders in the current folder.

GetItemsAsync(UInt32, UInt32)

Gets an index-based range of files and folders from the list of all files and subfolders in the current folder.

GetParentAsync()

Gets the parent folder of the current folder.

GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions)

Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail, the requested size, and the specified options

GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32)

Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail and the requested size.

GetScaledImageAsThumbnailAsync(ThumbnailMode)

Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail.

GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions)

Gets a thumbnail image for the current folder, sized for the specified purpose of the thumbnail and adjusted to the requested size with the specified options.

GetThumbnailAsync(ThumbnailMode, UInt32)

Gets a thumbnail image for the current folder, sized for the specified purpose of the thumbnail and adjusted to the requested size.

GetThumbnailAsync(ThumbnailMode)

Gets a thumbnail image for the current folder, sized for the specified purpose of the thumbnail.

IsCommonFileQuerySupported(CommonFileQuery)

Indicates whether the current folder supports the specified CommonFileQuery.

IsCommonFolderQuerySupported(CommonFolderQuery)

Indicates whether the current folder supports the specified CommonFolderQuery.

IsEqual(IStorageItem)

Indicates whether the current folder is equal to the specified folder.

IsOfType(StorageItemTypes)

Indicates whether the current StorageFolder matches the specified StorageItemTypes value.

RenameAsync(String, NameCollisionOption)

Renames the current folder and specifies what to do if a folder with the same name already exists.

RenameAsync(String)

Renames the current folder.

TryGetChangeTracker()

Gets the StorageLibraryChangeTracker associated with a StorageFolder.

TryGetItemAsync(String)

Tries to get the file or folder with the specified name from the current folder. Returns null instead of raising a FileNotFoundException if the specified file or folder is not found.

Applies to

See also