Dela via


StorageDevice Class

Definition

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 ref class StorageDevice abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Devices.Portable.PortableDeviceContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class StorageDevice final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Devices.Portable.PortableDeviceContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class StorageDevice
Public Class StorageDevice
Inheritance
Object Platform::Object IInspectable StorageDevice
Attributes

Windows requirements

Device family
Windows Desktop Extension SDK (introduced in 10.0.10240.0)
API contract
Windows.Devices.Portable.PortableDeviceContract (introduced in v1.0)
App capabilities
removableStorage

Examples

The following example shows the syntax of a call to FromId.

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

Remarks

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.

Methods

FromId(String)

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

GetDeviceSelector()

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

Applies to

See also