FolderPicker class

FolderPicker class

Represents a UI element that lets the user choose folders.


var folderPicker = new Windows.Storage.Pickers.FolderPicker();


The FolderPicker class has these types of members:


The FolderPicker class has these constructors.

FolderPicker Creates a new instance of a FolderPicker.



The FolderPicker class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

PickFolderAndContinue Shows the file picker so that the user can pick a folder, deactivating and the app and reactivating it when the operation is complete. (Windows Phone Store app)
PickSingleFolderAsync Shows the folderPicker object so that the user can pick a folder. (Windows Store app)



The FolderPicker class has these properties.

PropertyAccess typeDescription


Read/writeGets or sets the label text of the folder picker's commit button.


Read-onlyGets a set of values to be populated by the app before a PickFolderAndContinue operation that deactivates the app in order to provide context when the app is activated. (Windows Phone Store app)


Read-onlyGets the collection of file types that the folder picker displays.


Read/writeGets or sets the settings identifier associated with the with the current FolderPicker instance.


Read/writeGets or sets the initial location where the folder picker looks for folders to present to the user.


Read/writeGets or sets the view mode that the folder picker uses to display items.



To get started accessing files and folders file pickers, see Quickstart: Accessing files with file pickers.

To learn about using file pickers in Windows Phone Store apps, see How to continue your Windows Phone app after calling a file picker.

Warning  If you try to show the file picker while your app is snapped the file picker will not be shown and an exception will be thrown. You can avoid this by making sure your app is not snapped or by unsnapping it before you call the file picker. The following code examples and the File picker sample show you how.


The File picker sample demonstrates how to check whether the app is snapped, how to set file picker properties, and how to show a file picker so that the user can pick a folder for the app to access.

// Verify that we are currently not snapped, or that we can unsnap to open the picker
var currentState = Windows.UI.ViewManagement.ApplicationView.value;
if (currentState === Windows.UI.ViewManagement.ApplicationViewState.snapped &&
    !Windows.UI.ViewManagement.ApplicationView.tryUnsnap()) {
    // Fail silently if we can't unsnap

// Create the picker object and set options
var folderPicker = new Windows.Storage.Pickers.FolderPicker;
folderPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.desktop;
// Users expect to have a filtered view of their folders depending on the scenario.
// For example, when choosing a documents folder, restrict the filetypes to documents for your application.
folderPicker.fileTypeFilter.replaceAll([".docx", ".xlsx", ".pptx"]);

folderPicker.pickSingleFolderAsync().then(function (folder) {
    if (folder) {
        // Application now has read/write access to all contents in the picked folder (including sub-folder contents)
        // Cache folder so the contents can be accessed at a later time
        Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList.addOrReplace("PickedFolderToken", folder);
        WinJS.log && WinJS.log("Picked folder: " +, "sample", "status");
    } else {
        // The picker was dismissed with no selected file
        WinJS.log && WinJS.log("Operation cancelled.", "sample", "status");

For C#, the File picker sample demonstrates how to check whether your app is snapped in the EnsureUnsnapped method.

internal bool EnsureUnsnapped()
    // FilePicker APIs will not work if the application is in a snapped state.
    // If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
    bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());
    if (!unsnapped)
        NotifyUser("Cannot unsnap the sample.", NotifyType.StatusMessage);

    return unsnapped;

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Storage::Pickers [C++]



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.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Storage::Pickers [C++]





See also

File picker sample
Quickstart: Accessing files with file pickers
How to continue your Windows Phone app after calling a file picker



© 2016 Microsoft