Dela via


StorageDevice.FromId(String) Method

Definition

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

public:
 static StorageFolder ^ FromId(Platform::String ^ deviceId);
 static StorageFolder FromId(winrt::hstring const& deviceId);
public static StorageFolder FromId(string deviceId);
function fromId(deviceId)
Public Shared Function FromId (deviceId As String) As StorageFolder

Parameters

deviceId
String

Platform::String

winrt::hstring

The DeviceInformation ID that identifies the removable storage device. This id can be retrieved from Windows.Devices.Enumeration or the DeviceInformationId property of the AutoPlay device event arguments. For more information, see Quickstart: Register an app for an AutoPlay device. In order for FromId to succeed, the app must declare both the removableStorage capability as shown in the App capability declarations and file type associations for the files it wishes to access on the device as shown in How to handle file activation. For more information, see the Removable Storage sample.

Returns

The storage folder object that represents the removable storage device and provides access to content on the device.

Windows requirements

App capabilities
removableStorage

Remarks

Pass the selector string from GetDeviceSelector to the Windows.Devices.Enumeration API to get a collection of DeviceInformation objects representing storage devices. Select the DeviceInformation object for the storage you want to access, and use its Id property as the deviceInformationId parameter to FromId.

Applies to

See also