Share via


PnpObject.CreateFromIdAsync Method

Definition

Important

We no longer recommend that you use the types in the Windows.Devices.Enumeration.Pnp namespace. Instead, the types in the Windows.Devices.Enumeration namespace implement a modern, and better maintained, superset of the functionality of Windows.Devices.Enumeration.Pnp.

The alternative to PnpObjectType is the Windows.Devices.Enumeration.DeviceInformationKind enum, which you can pass as a parameter to Windows.Devices.Enumeration APIs. For example, instead of using PnpObjectType when you create a PnpObjectWatcher, use DeviceInformationKind when you create a DeviceWatcher.

Creates a PnpObject object asynchronously from a previously saved DeviceInformation ID.

public:
 static IAsyncOperation<PnpObject ^> ^ CreateFromIdAsync(PnpObjectType type, Platform::String ^ id, IIterable<Platform::String ^> ^ requestedProperties);
 static IAsyncOperation<PnpObject> CreateFromIdAsync(PnpObjectType const& type, winrt::hstring const& id, IIterable<winrt::hstring> const& requestedProperties);
public static IAsyncOperation<PnpObject> CreateFromIdAsync(PnpObjectType type, string id, IEnumerable<string> requestedProperties);
function createFromIdAsync(type, id, requestedProperties)
Public Shared Function CreateFromIdAsync (type As PnpObjectType, id As String, requestedProperties As IEnumerable(Of String)) As IAsyncOperation(Of PnpObject)

Parameters

type
PnpObjectType

The type of the PnpObject.

id
String

Platform::String

winrt::hstring

The string value identifying the PnpObject.

requestedProperties

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

An iterable list of additional properties to include in the Properties property of the PnpObject object to create. For more info on what the properties represent, see Device information properties.

Returns

The PnpObject created from the previously saved DeviceInformation ID.

Applies to