Windows Dev Center

KnownFolders.RemovableDevices | removableDevices property

Gets the removable devices folder.

Syntax


public static StorageFolder RemovableDevices { get; }

Property value

Type: StorageFolder

The removable devices folder.

Remarks

Prerequisites

To access the removable devices folder, do the following things.

  • In the app manifest, specify the Removable Storage capability. Learn more about capabilities in Access to user resources using the Windows Runtime.

  • In the app manifest, register at least one File Type Association declaration. This declaration explicitly indicates the file types (extensions) that your app wants to access on the removable devices. The app can only enumerate, create, or change files that have the file types declared in the app manifest. For more info, see How to handle file activation.

Return value

To work with the removable devices folder and its contents, call the methods and properties of the StorageFolder class. For general info about how to use files and folders, see Quickstart: Accessing files programmatically.

The folder returned by the RemovableDevices property is a virtual folder. This virtual folder contains a subfolder for each removable device that's present. For example, if a single removable device is attached to the computer, the removable devices folder contains a single subfolder for which the name and path may be D:\.

If no removable devices are available, reading the value of this property returns an empty folder. It does not raise an exception.

More info

In the removable devices folder, the app sees only the files that correspond to the file type associations registered in the app's manifest. For example, an app that registers only the .txt file type association sees only the text files in the removable devices folder.

You can enumerate files and folders in the removable devices folder. When you create a CommonFileQuery or CommonFolderQuery query, however, you can only specify the DefaultQuery, OrderByName, or OrderBySearchRank options.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Capabilities

removableStorage

Requirements (Windows 8.x and Windows Phone 8.x)

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]

Namespace

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

Metadata

Windows.winmd

Capabilities

removableStorage

See also

KnownFolders
Reference
CreateFileQuery
CreateFileQueryWithOptions
CreateFolderQuery
CreateFolderQueryWithOptions

 

 

Show:
© 2015 Microsoft