KnownFolders class

Applies to Windows and Windows Phone

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

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

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

CameraRoll

Read-onlyGets the Camera Roll folder.

DocumentsLibrary

Read-onlyGets the Documents library.

HomeGroup

Read-onlyGets the HomeGroup folder.

MediaServerDevices

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

MusicLibrary

Read-onlyGets the Music library.

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. 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

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

Metadata

Windows.winmd

See also

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:
© 2014 Microsoft. All rights reserved.