Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public ref class KnownFolders abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)] /// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] class KnownFolders final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)] [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] public static class KnownFolders
Public Class KnownFolders
Object IInspectable KnownFolders
Windows 10 (introduced in 10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced in v1.0)
StorageFolder storageFolder = KnownFolders.PicturesLibrary; StorageFile file = await storageFolder.CreateFileAsync("sample.png", CreationCollisionOption.ReplaceExisting); // Do something with the new file.
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 App capability declarations.
- For info about how to use pictures, music, and videos in your app, see Audio, video, and camera.
- For general info about how to use files and folders, see Enumerate and query files and folders.
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 permissions.
|Windows version||SDK version||Value added|
Gets the App Captures folder.
Gets the Camera Roll folder.
Gets the Documents library. The Documents library is not intended for general use.
Gets the HomeGroup folder.
Gets the folder of media server (Digital Living Network Alliance (DLNA)) devices.
Gets the Music library.
Gets the Objects 3D folder.
Gets the Pictures library.
Gets the play lists folder.
Gets the recorded calls folder.
Gets the removable devices folder.
Gets the Saved Pictures folder.
Gets the Videos library.
Retrieves the folder for the folderId specified.
Static method that returns a specified known folder for a User.
Requests access for the capability controlling access to the folder.
Requests access for the user and folderId.
Submit and view feedback for