KnownFolders KnownFolders KnownFolders KnownFolders KnownFolders Class

Definition

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 : static class KnownFolders
static struct winrt::Windows::Storage::KnownFolders
public static class KnownFolders
Public Shared Class KnownFolders
// 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)

Examples

The File access sample shows you how to use the PicturesLibrary property to create a new file in the Pictures library.

StorageFolder storageFolder = KnownFolders.PicturesLibrary;
StorageFile file = await storageFolder.CreateFileAsync("sample.png", CreationCollisionOption.ReplaceExisting);
// Do something with the new file.
Windows.Storage.KnownFolders.picturesLibrary.createFileAsync("sample.png", Windows.Storage.CreationCollisionOption.replaceExisting).done(
   function (file) {
       // Process file
   },
   // Handle errors with an error function
   function (error) {
       // Process errors
   }
);

After the CreateFileAsync method completes, the file variable contains a StorageFile that represents the new file.

Remarks

This class is static and cannot be instantiated. Access its properties directly, as shown in the following example.

  • StorageFolder storageFolder = KnownFolders.PicturesLibrary;

Prerequisites

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.

Return value

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.

More info

Here's how to access some other commonly used locations.

To learn more about the locations that your app can access, see File access permissions.

Properties

AppCaptures AppCaptures AppCaptures AppCaptures AppCaptures

Gets the App Captures folder.

CameraRoll CameraRoll CameraRoll CameraRoll CameraRoll

Gets the Camera Roll folder.

DocumentsLibrary DocumentsLibrary DocumentsLibrary DocumentsLibrary DocumentsLibrary

Gets the Documents library. The Documents library is not intended for general use.

HomeGroup HomeGroup HomeGroup HomeGroup HomeGroup

Gets the HomeGroup folder.

MediaServerDevices MediaServerDevices MediaServerDevices MediaServerDevices MediaServerDevices

Gets the folder of media server (Digital Living Network Alliance (DLNA)) devices.

MusicLibrary MusicLibrary MusicLibrary MusicLibrary MusicLibrary

Gets the Music library.

Objects3D Objects3D Objects3D Objects3D Objects3D

Gets the Objects 3D folder.

PicturesLibrary PicturesLibrary PicturesLibrary PicturesLibrary PicturesLibrary

Gets the Pictures library.

Playlists Playlists Playlists Playlists Playlists

Gets the play lists folder.

RecordedCalls RecordedCalls RecordedCalls RecordedCalls RecordedCalls

Gets the recorded calls folder.

RemovableDevices RemovableDevices RemovableDevices RemovableDevices RemovableDevices

Gets the removable devices folder.

SavedPictures SavedPictures SavedPictures SavedPictures SavedPictures

Gets the Saved Pictures folder.

VideosLibrary VideosLibrary VideosLibrary VideosLibrary VideosLibrary

Gets the Videos library.

Methods

GetFolderForUserAsync(User, KnownFolderId) GetFolderForUserAsync(User, KnownFolderId) GetFolderForUserAsync(User, KnownFolderId) GetFolderForUserAsync(User, KnownFolderId) GetFolderForUserAsync(User, KnownFolderId)

Static method that returns a specified known folder for a User.

See Also