Expand Minimize

StorageFolder class

Applies to Windows and Windows Phone

Manages folders and their contents and provides information about them.

Syntax


Public NotInheritable Class StorageFolder
    Implements IStorageFolder, _
    IStorageItem, _
    IStorageFolderQueryOperations, _
    IStorageItemProperties, _
    IStorageItemProperties2, _
    IStorageItem2, _
    IStorageFolder2, _
    IStorageItemPropertiesWithProvider

Attributes

[Version(0x06020000)]

Members

The StorageFolder class has these types of members:

Methods

The StorageFolder class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
AreQueryOptionsSupported Indicates whether the current folder supports the specified QueryOptions.
CreateFileAsync(String) Creates a new file with the specified name in the current folder.
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() 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 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) Creates a new subfolder with the specified name in the current folder.
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() 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 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 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 Gets the file with the specified name from the current folder.
GetFilesAsync() Gets the files in the current folder.
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) 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 Gets the subfolder with the specified name from the current folder.
GetFolderFromPathAsync Gets the folder that has the specified absolute path in the file system.
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.
GetIndexedStateAsync Gets the indexed state of the current folder.
GetItemAsync 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) Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail.
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) Gets a scaled image as a thumbnail, determined by the purpose of the thumbnail, the requested size, and the specified options
GetThumbnailAsync(ThumbnailMode) Gets a thumbnail image for the current folder, sized for the specified purpose of the thumbnail.
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) 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 Indicates whether the current folder supports the specified CommonFileQuery.
IsCommonFolderQuerySupported Indicates whether the current folder supports the specified CommonFolderQuery.
IsEqual Indicates whether the current folder is equal to the specified folder.
IsOfType Indicates whether the current StorageFolder matches the specified StorageItemTypes value.
RenameAsync(String) Renames the current folder.
RenameAsync(String, NameCollisionOption) Renames the current folder and specifies what to do if a folder with the same name already exists.
TryGetItemAsync Tries to get the file or folder with the specified name from the current folder. Returns null instead of raising an exception if the specified file or folder is not found.

 

Properties

The StorageFolder class has these properties.

PropertyAccess typeDescription

Attributes

Read-onlyGets the attributes of the current folder.

DateCreated

Read-onlyGets the date and time that the current folder was created.

DisplayName

Read-onlyGets the user-friendly name of the current folder.

DisplayType

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

FolderRelativeId

Read-onlyGets 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

Read-onlyGets the name of the current folder.

Path

Read-onlyGets the full path of the current folder in the file system, if the path is available.

Properties

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

Provider

Read-onlyGets the StorageProvider object that contains info about the service that stores the current folder.

 

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.

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

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

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

Metadata

Windows.winmd

Capabilities

picturesLibrary
videosLibrary
musicLibrary
documentsLibrary

See also

StorageFile

 

 

Show:
© 2014 Microsoft