StorageDevice StorageDevice StorageDevice StorageDevice StorageDevice Class


Provides methods for accessing the storage functionality of a portable device that supports WPD. Removable storage devices include:

  • USB mass storage flash drives and cameras
  • Media Transfer Protocol (MTP) music players, phones, and cameras
  • Picture Transfer Protocol (PTP) cameras
public : static class StorageDevice
static struct winrt::Windows::Devices::Portable::StorageDevice
public static class StorageDevice
Public Shared Class StorageDevice
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Devices.Portable.PortableDeviceContract (introduced v1)


The following example shows how to get an interface ID using GetDeviceSelector and the Windows.Devices.Enumeration API. It also shows how to pass it to FromId to get a StorageFolder for a removable storage device.

    Enum = Windows.Devices.Enumeration;

    // Enumerate removable storage devices.
    // The success callback selects the removable storage to use.
    function pickStorageToGetImageFrom() {

    // Handler that's called when removable storages are found.
    // storageDevices: A collection of type
    // Windows.Devices.Enumeration.DeviceInformationCollection.
    // This example just takes the first storage found in the list.
    function successCallback(storageDevices) {
        var removableStorage = null;
        if (storageDevices.length) {
            try {
                // Get the StorageFoler from the id for the first removable storage device
                removableStorage = Windows.Devices.Portable.StorageDevice.fromId(
                // document.getElementById("output").innerHTML = storageDevices.getAt(0).name; 
            } catch (e) {
                document.getElementById("output").innerHTML =
                "Error: " + e.message;
            if (removableStorage != null) {
        } else {
            document.getElementById("output").innerHTML =
                "No removable storage devices were found.";

The following examples show the syntax of a call to FromId in C# and C++.

var folder = StorageDevice.FromId(deviceInformationId);
StorageFolder folder{ StorageDevice::FromId(deviceInformationId) };
StorageFolder^ folder = StorageDevice::FromId(deviceInformationId);


To access the device services, you must declare the device service in the capabilities section of the app manifest file. For a list of the GUIDs representing the device services, see Windows.Devices.Portable.


FromId(String) FromId(String) FromId(String) FromId(String) FromId(String)

Gets a StorageFolder object from a DeviceInformation Id for a removable storage device.

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

An Advanced Query Syntax (AQS) string for identifying removable storage devices. This string is passed to the FindAllAsync or CreateWatcher method.

See Also