In the previous posts I described the restrictions in file system access dictated by Windows 8 for WinRT apps. With user’s help and by using file and folder pickers your app can get an access to any file system object, but there is a limited number of folders accessible for the app via direct API calls. Here I want to summarize information about these folders.

Local app data

Local data folder allows you to store any application-related files. The folder is private and isolated so any other Metro apps are not allowed to access the stored files.

The folder will be completely erased if the app is uninstalled.


// C#
StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

// XAML
<Image Source="ms-appdata:///local/myFile.png"/>

Roaming app data

Roaming folder provides you a way to store the files and synchronize them across multiple systems associated with the same Live ID (Microsoft Account).

Roaming folder size is limited and can be determined by using ApplicationData.Current.RoamingStorageQuota and ApplicationData.Current.RoamingStorageUsage variables. If folder size exceeds the quota, Windows suspends data synchronization.


// C#
StorageFolder roamingFolder = Windows.Storage.ApplicationData.Current.RoamingFolder;

// XAML
<Image Source="ms-appdata:///roaming/myFile.png"/>

Temporary app data

Temporary folder can be used to store the app’s temporary data.

Files stored in the folder can be removed at any time by system or by user via Disk Cleanup.


// C#
StorageFolder tempFolder = Windows.Storage.ApplicationData.Current.TemporaryFolder;

// XAML
<Image Source="ms-appdata:///temp/myFile.png"/>

App installed location

Metro-style apps can access all the files included in the package and installed to the target system.


// C#
StorageFolder installFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;

// XAML
<Image Source="ms-appx:///myFile.png"/>

Downloads folder

User’s Downloads folder is available for your app if you need to save downloaded files.

This folder is available in write-only mode. Your app can use it to save files but it is not able to read the files downloaded by other apps.


StorageFolder tempFolder = Windows.Storage.DownloadsFolder;

Documents library

User’s documents folder.

To be able to access this folder you need to specify Document Library capability in the app’s manifest. Additionally, File Type Association must be declared for the each document type that will be accessed by the app.


StorageFolder folder = Windows.Storage.KnownFolders.DocumentsLibrary;

Music library

User’s music folder.

To be able to access this folder you need to specify Music Library capability in the app’s manifest.


StorageFolder folder = Windows.Storage.KnownFolders.MusicLibrary;

Pictures library

User’s pictures folder.

To be able to access this folder you need to specify Pictures Library capability in the app’s manifest.


StorageFolder folder = Windows.Storage.KnownFolders.PicturesLibrary;

Videos library

User’s videos folder.

To be able to access this folder you need to specify Videos Library capability in the app’s manifest.


StorageFolder folder = Windows.Storage.KnownFolders.VideosLibrary;

Removable devices

WinRT provides access to files and folder located at the removable devices such as USB sticks and external hard drives using RemovableDevices folder.

To be able to access this folder you need to specify Removable Storage capability in the app’s manifest. Additionally, File Type Association must be declared for the each file type that will be accessed by the app.


StorageFolder folder = Windows.Storage.KnownFolders.RemovableDevices;

See also Working with external storage devices from Windows 8 apps

Home group

HomeGroup folder allows you to access files and folders shared by other home computers.

Your application must to declare at least one library access capability (Pictures, Music or Videos) to be able to use this location. Shared Documents Libraries are not available for the Metro apps even if the corresponding capability is declared in the manifest.


StorageFolder folder = Windows.Storage.KnownFolders.HomeGroup;

Media Server devices

MediaServerDevices folder allows you to access files and folders shared by network media servers.

Your application must to declare at least one library access capability (Pictures, Music or Videos) to be able to use this location. Shared Documents Libraries are not available for the apps even if the corresponding capability is declared in the manifest.


StorageFolder folder = Windows.Storage.KnownFolders.MediaServerDevices;

blog comments powered by Disqus