StorageFolder StorageFolder StorageFolder StorageFolder StorageFolder Class

Definition

Manages folders and their contents and provides information about them.

public : sealed class StorageFolder : IStorageFolder, IStorageFolder2, IStorageFolder3, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
struct winrt::Windows::Storage::StorageFolder : IStorageFolder, IStorageFolder2, IStorageFolder3, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
public sealed class StorageFolder : IStorageFolder, IStorageFolder2, IStorageFolder3, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
Public NotInheritable Class StorageFolder Implements IStorageFolder, IStorageFolder2, IStorageFolder3, IStorageItem, IStorageItem2, IStorageItemProperties, IStorageItemProperties2, IStorageItemPropertiesWithProvider, IStorageFolderQueryOperations
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
musicLibrary picturesLibrary videosLibrary documentsLibrary

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.

Properties

Attributes Attributes Attributes Attributes Attributes

Gets the attributes of the current folder.

DateCreated DateCreated DateCreated DateCreated DateCreated

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

DisplayName DisplayName DisplayName DisplayName DisplayName

Gets the user-friendly name of the current folder.

DisplayType DisplayType DisplayType DisplayType DisplayType

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

FolderRelativeId FolderRelativeId FolderRelativeId FolderRelativeId 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 Name Name Name Name

Gets the name of the current folder.

Path Path Path Path Path

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

Properties Properties Properties Properties Properties

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

Provider Provider Provider Provider Provider

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

Methods

AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions) AreQueryOptionsSupported(QueryOptions)

Indicates whether the current folder supports the specified QueryOptions.

CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String)

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

CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) 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.

CreateFileQuery() CreateFileQuery() CreateFileQuery() CreateFileQuery() CreateFileQuery()

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

CreateFileQuery(CommonFileQuery) CreateFileQuery(CommonFileQuery) CreateFileQuery(CommonFileQuery) CreateFileQuery(CommonFileQuery) 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) CreateFileQueryWithOptions(QueryOptions) CreateFileQueryWithOptions(QueryOptions) CreateFileQueryWithOptions(QueryOptions) 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) CreateFolderAsync(String) CreateFolderAsync(String) CreateFolderAsync(String) CreateFolderAsync(String)

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

CreateFolderAsync(String, CreationCollisionOption) CreateFolderAsync(String, CreationCollisionOption) CreateFolderAsync(String, CreationCollisionOption) CreateFolderAsync(String, CreationCollisionOption) 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.

CreateFolderQuery() CreateFolderQuery() CreateFolderQuery() CreateFolderQuery() CreateFolderQuery()

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

CreateFolderQuery(CommonFolderQuery) CreateFolderQuery(CommonFolderQuery) CreateFolderQuery(CommonFolderQuery) CreateFolderQuery(CommonFolderQuery) 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) CreateFolderQueryWithOptions(QueryOptions) CreateFolderQueryWithOptions(QueryOptions) CreateFolderQueryWithOptions(QueryOptions) 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() CreateItemQuery() CreateItemQuery() CreateItemQuery() CreateItemQuery()

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

CreateItemQueryWithOptions(QueryOptions) CreateItemQueryWithOptions(QueryOptions) CreateItemQueryWithOptions(QueryOptions) CreateItemQueryWithOptions(QueryOptions) 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() DeleteAsync() DeleteAsync() DeleteAsync() DeleteAsync()

Deletes the current folder.

DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption) DeleteAsync(StorageDeleteOption)

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

GetBasicPropertiesAsync() GetBasicPropertiesAsync() GetBasicPropertiesAsync() GetBasicPropertiesAsync() GetBasicPropertiesAsync()

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

GetFileAsync(String) GetFileAsync(String) GetFileAsync(String) GetFileAsync(String) GetFileAsync(String)

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

GetFilesAsync() GetFilesAsync() GetFilesAsync() GetFilesAsync() GetFilesAsync()

Gets the files in the current folder.

GetFilesAsync(CommonFileQuery) GetFilesAsync(CommonFileQuery) GetFilesAsync(CommonFileQuery) GetFilesAsync(CommonFileQuery) 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.

GetFilesAsync(CommonFileQuery, UInt32, UInt32) GetFilesAsync(CommonFileQuery, UInt32, UInt32) GetFilesAsync(CommonFileQuery, UInt32, UInt32) GetFilesAsync(CommonFileQuery, UInt32, UInt32) 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.

GetFolderAsync(String) GetFolderAsync(String) GetFolderAsync(String) GetFolderAsync(String) GetFolderAsync(String)

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

GetFolderFromPathAsync(String) GetFolderFromPathAsync(String) GetFolderFromPathAsync(String) GetFolderFromPathAsync(String) GetFolderFromPathAsync(String)

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

GetFoldersAsync() GetFoldersAsync() GetFoldersAsync() GetFoldersAsync() GetFoldersAsync()

Gets the subfolders in the current folder.

GetFoldersAsync(CommonFolderQuery) GetFoldersAsync(CommonFolderQuery) GetFoldersAsync(CommonFolderQuery) GetFoldersAsync(CommonFolderQuery) 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) GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) GetFoldersAsync(CommonFolderQuery, UInt32, UInt32) 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.

GetIndexedStateAsync() GetIndexedStateAsync() GetIndexedStateAsync() GetIndexedStateAsync() GetIndexedStateAsync()

Gets the indexed state of the current folder.

GetItemAsync(String) GetItemAsync(String) GetItemAsync(String) GetItemAsync(String) GetItemAsync(String)

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

GetItemsAsync() GetItemsAsync() GetItemsAsync() GetItemsAsync() GetItemsAsync()

Gets the files and subfolders in the current folder.

GetItemsAsync(UInt32, UInt32) GetItemsAsync(UInt32, UInt32) GetItemsAsync(UInt32, UInt32) GetItemsAsync(UInt32, UInt32) 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() GetParentAsync() GetParentAsync() GetParentAsync() GetParentAsync()

Gets the parent folder of the current folder.

GetScaledImageAsThumbnailAsync(ThumbnailMode) GetScaledImageAsThumbnailAsync(ThumbnailMode) GetScaledImageAsThumbnailAsync(ThumbnailMode) GetScaledImageAsThumbnailAsync(ThumbnailMode) GetScaledImageAsThumbnailAsync(ThumbnailMode)

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

GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32)

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

GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetScaledImageAsThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) 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

GetThumbnailAsync(ThumbnailMode) GetThumbnailAsync(ThumbnailMode) GetThumbnailAsync(ThumbnailMode) GetThumbnailAsync(ThumbnailMode) GetThumbnailAsync(ThumbnailMode)

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

GetThumbnailAsync(ThumbnailMode, UInt32) GetThumbnailAsync(ThumbnailMode, UInt32) GetThumbnailAsync(ThumbnailMode, UInt32) GetThumbnailAsync(ThumbnailMode, UInt32) 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, UInt32, ThumbnailOptions) GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions) 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.

IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery) IsCommonFileQuerySupported(CommonFileQuery)

Indicates whether the current folder supports the specified CommonFileQuery.

IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery) IsCommonFolderQuerySupported(CommonFolderQuery)

Indicates whether the current folder supports the specified CommonFolderQuery.

IsEqual(IStorageItem) IsEqual(IStorageItem) IsEqual(IStorageItem) IsEqual(IStorageItem) IsEqual(IStorageItem)

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

IsOfType(StorageItemTypes) IsOfType(StorageItemTypes) IsOfType(StorageItemTypes) IsOfType(StorageItemTypes) IsOfType(StorageItemTypes)

Indicates whether the current StorageFolder matches the specified StorageItemTypes value.

RenameAsync(String) RenameAsync(String) RenameAsync(String) RenameAsync(String) RenameAsync(String)

Renames the current folder.

RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption) RenameAsync(String, NameCollisionOption)

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

TryGetChangeTracker() TryGetChangeTracker() TryGetChangeTracker() TryGetChangeTracker() TryGetChangeTracker()

Gets the StorageLibraryChangeTracker associated with a StorageFolder.

TryGetItemAsync(String) TryGetItemAsync(String) TryGetItemAsync(String) TryGetItemAsync(String) 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.

See Also