Provides access to common locations that contain user content. This includes content from a user's local libraries (such as Documents, Pictures, Music, and Videos), HomeGroup, removable devices, and media server devices.
The KnownFolders class has these types of members:
The KnownFolders class inherits methods from the Object class (C#/VB/C++).
The KnownFolders class has these properties.
|Read-only||Gets the Camera Roll folder.|
|Read-only||Gets the Documents library. The Documents library is not intended for general use.|
|Read-only||Gets the HomeGroup folder.|
|Read-only||Gets the folder of media server (Digital Living Network Alliance (DLNA)) devices.|
|Read-only||Gets the Music library.|
|Read-only||Gets the Pictures library.|
|Read-only||Gets the play lists folder.|
|Read-only||Gets the removable devices folder.|
|Read-only||Gets the Saved Pictures folder.|
|Read-only||Gets the Videos library.|
This class is static and cannot be instantiated. Access its properties directly, as shown in the following example.
StorageFolder storageFolder = KnownFolders.PicturesLibrary;
To access the folders and libraries represented by the properties of this class, specify the corresponding capabilities in your app manifest. For example, to access KnownFolders.PicturesLibrary, specify the Pictures Library capability in the app manifest. Learn more about capabilities in Access to user resources using the Windows Runtime.
The properties of the KnownFolders class return a StorageFolder. To work with the known folder and its contents, call the methods and properties of the StorageFolder class.
For info about how to use pictures, music, and videos in your app, see Adding multimedia.
For general info about how to use files and folders, see Quickstart: Accessing files programmatically.
Here's how to access some other commonly used locations.
Get the app's local folder from the Windows.Storage.ApplicationData.Current.LocalFolder property.
Get the app's installation folder from the Windows.ApplicationModel.Package.Current.InstalledLocation property.
To learn more about the locations that your app can access, see File access and permissions in Windows Store apps.
StorageFolder storageFolder = KnownFolders.PicturesLibrary; StorageFile file = await storageFolder.CreateFileAsync("sample.png", CreationCollisionOption.ReplaceExisting); // Do something with the new file.
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|
- File access sample
- Access to user resources using the Windows Runtime
- File access and permissions in Windows Store apps
- Quickstart: Accessing files programmatically
- StorageFile class
- StorageFolder class
- Windows.Storage.Search namespace