Windows Dev Center

KnownFolders class

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.

Syntax


public static class KnownFolders

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.

PropertyAccess typeDescription

AppCaptures

Read-onlyGets the App Captures folder.

CameraRoll

Read-onlyGets the Camera Roll folder.

DocumentsLibrary

Read-onlyGets the Documents library. The Documents library is not intended for general use.

HomeGroup

Read-onlyGets the HomeGroup folder.

MediaServerDevices

Read-onlyGets the folder of media server (Digital Living Network Alliance (DLNA)) devices.

MusicLibrary

Read-onlyGets the Music library.

Objects3D

Read-onlyGets the Objects 3D folder.

PicturesLibrary

Read-onlyGets the Pictures library.

Playlists

Read-onlyGets the play lists folder.

RemovableDevices

Read-onlyGets the removable devices folder.

SavedPictures

Read-onlyGets the Saved Pictures folder.

VideosLibrary

Read-onlyGets the Videos library.

 

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 Access to user resources using the Windows Runtime.

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 and permissions in Windows Store apps.

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.

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

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

See also

Object
File access sample
Access to user resources using the Windows Runtime
File access and permissions in Windows Store apps
Quickstart: Accessing files programmatically
Reference
StorageFile class
StorageFolder class
Windows.Storage.Search namespace

 

 

Show:
© 2015 Microsoft