KnownFolders.DocumentsLibrary | documentsLibrary property

Applies to Windows and Windows Phone

Gets the Documents library.


var documentsLibrary = Windows.Storage.KnownFolders.documentsLibrary;

Property value

Type: StorageFolder

The Documents library.


Note   Unlike other libraries, your app must use the File Type Association declaration in the app manifest file to explicitly declare what file types (extensions) will be accessed or created in the Documents library. This requirement is in addition to the Documents library capability. Learn more about capabilities in Access to user resources using the Windows Runtime.

Libraries, a concept introduced in Windows 7, allow users to view related user content from a single location. Because the library is a virtual location, folders that are added to or removed from a library continue to exist in their original locations as well. Learn more about libraries in Windows Libraries.

You can't use the Documents library in a Windows Phone Store app.

  • You can't publish a Windows Phone Store app that specifies the documentsLibrary capability to the Windows Phone Store. The Store blocks the publishing of the app.

  • Your app can't access the Documents library in the phone's internal storage. If another app creates a Documents folder on the optional SD card, however, your app can see that folder.


The File Access sample shows you how to use the documentsLibrary property to create a new file in the Documents library. This example assumes that the conditions described in this topic for using the Document library in a Windows Store app have been satisfied.

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 contains the new file as a storageFile.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Storage [C++]





See also




© 2014 Microsoft