Provides access to common locations that contain user content. This includes content from a user's local libraries (like Pictures, Documents, Music, or Videos), removable devices, HomeGroup, and media server devices.
Syntax
var knownFolders = Windows.Storage.KnownFolders;
Attributes
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.Storage.IKnownFoldersStatics, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
Members
The KnownFolders class has these types of members:
Methods
The KnownFolders class inherits methods from the Object class (C#/VB/C++).
Properties
The KnownFolders class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Windows Phone only. Gets the Camera Roll folder. | |
| Read-only | Gets the Documents library. | |
| Read-only | Gets the HomeGroup folder. | |
| Read-only | Gets the media server (Digital Living Network Alliance (DLNA)) devices folder. | |
| Read-only | Gets the Music library. | |
| Read-only | Gets the Pictures library. | |
| Read-only | Gets the removable devices folder. | |
| Read-only | Windows Phone only. Gets the Saved Pictures folder. | |
| Read-only | Gets the Videos library. |
Remarks
This class is static and cannot be instantiated. Call the methods directly instead.
To learn more about what locations your app can access, see File access and permissions in Windows Store apps.
In order to access the folder and libraries represented by the properties of this class, you must declare the necessary capabilities in your app manifest. Learn more about capabilities in Access to user resources using the Windows Runtime.
Examples
The File Access sample shows you how to use the documentsLibrary property to create a new file in the Documents library.
Windows.Storage.KnownFolders.documentsLibrary.createFileAsync("sample.dat", Windows.Storage.CreationCollisionOption.replaceExisting).done( function (file) { // Process file }, // Handle errors with an error function function (error) { // Process errors } );
After createFileAsync completes, the file variable gets the new file as a storageFile.
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 |
|
|
Metadata |
|
See also
Build date: 2/25/2013