KnownFolders class

4 out of 5 rated this helpful - Rate this topic

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.

PropertyAccess typeDescription

CameraRoll

Read-onlyWindows Phone only. Gets 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.

RemovableDevices

Read-onlyGets the removable devices folder.

SavedPictures

Read-onlyWindows Phone only. Gets 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

StorageFolder

 

 

Build date: 2/25/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.