DeviceInformation.CreateFromIdAsync Method

Definition

Overloads

CreateFromIdAsync(String)

Creates a DeviceInformation object from a DeviceInformation ID.

CreateFromIdAsync(String, IEnumerable<String>)

Creates a DeviceInformation object from a DeviceInformation ID and a list of additional properties.

CreateFromIdAsync(String, IEnumerable<String>, DeviceInformationKind)

Creates a DeviceInformation object from a DeviceInformation ID, a list of additional properties, and a DeviceInformationKind parameter.

CreateFromIdAsync(String)

Creates a DeviceInformation object from a DeviceInformation ID.

public:
 static IAsyncOperation<DeviceInformation ^> ^ CreateFromIdAsync(Platform::String ^ deviceId);
 static IAsyncOperation<DeviceInformation> CreateFromIdAsync(winrt::hstring const & deviceId);
[Windows.Foundation.Metadata.Overload("CreateFromIdAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<DeviceInformation> CreateFromIdAsync(string deviceId);
function createFromIdAsync(deviceId)
Public Shared Function CreateFromIdAsync (deviceId As String) As IAsyncOperation(Of DeviceInformation)

Parameters

deviceId
String

The device ID.

Returns

Attributes

Examples

The savedId variable in this example is a DeviceInformation ID previously saved by the application, obtained from the id property of the last-used DeviceInformation object.


    // Create a DeviceInformation object from a saved ID
    var Enum = Windows.Devices.Enumeration;
    var DevInf = Enum.DeviceInformation;
    DevInf.createFromIdAsync(savedId).then(
        function(devinfo) {
            // Use the created DeviceInformation object
            printMessage("Created DeviceInformation. Name: " + devinfo.name);
        },
        function (e) {
            displayError("Failed to create DeviceInformation: " + e.message);
        });

See also

CreateFromIdAsync(String, IEnumerable<String>)

Creates a DeviceInformation object from a DeviceInformation ID and a list of additional properties.

public:
 static IAsyncOperation<DeviceInformation ^> ^ CreateFromIdAsync(Platform::String ^ deviceId, IIterable<Platform::String ^> ^ additionalProperties);
 static IAsyncOperation<DeviceInformation> CreateFromIdAsync(winrt::hstring const & deviceId, IIterable<winrt::hstring> const & additionalProperties);
[Windows.Foundation.Metadata.Overload("CreateFromIdAsyncAdditionalProperties")]
public static IAsyncOperation<DeviceInformation> CreateFromIdAsync(string deviceId, IEnumerable<string> additionalProperties);
function createFromIdAsync(deviceId, additionalProperties)
Public Shared Function CreateFromIdAsync (deviceId As String, additionalProperties As IEnumerable(Of String)) As IAsyncOperation(Of DeviceInformation)

Parameters

deviceId
String

A string containing the DeviceInformation ID.

additionalProperties
IEnumerable<String>

An iterable list of additional properties to include in the Properties property of the DeviceInformation objects in the enumeration results. For more info on what the properties represent, see Device information properties.

Returns

Attributes

Examples

The following example builds a list of properties to include in the DeviceInformation object to create from a DeviceInformation ID.The savedId variable in this example is a DeviceInformation ID previously saved by the application, obtained from the id property of the last-used DeviceInformation object.


    // Create a set of two additional properties
    var propertiesToRetrieve = new Array();
    propertiesToRetrieve.push("System.InterfaceClassGuid");
    propertiesToRetrieve.push("System.Storage.IsPortable");

    // Create a DeviceInformation object from a saved ID
    var Enum = Windows.Devices.Enumeration;
    var DevInf = Enum.DeviceInformation;
    DevInf.createFromIdAsync(savedId, propertiesToRetrieve).then(
        function(devinfo) {
            // Use the created DeviceInformation object
            printMessage("Created DeviceInformation. Name: " + devinfo.name);
        },
        function (e) {
            displayError("Failed to create DeviceInformation: " + e.message);
        });



See also

CreateFromIdAsync(String, IEnumerable<String>, DeviceInformationKind)

Creates a DeviceInformation object from a DeviceInformation ID, a list of additional properties, and a DeviceInformationKind parameter.

public:
 static IAsyncOperation<DeviceInformation ^> ^ CreateFromIdAsync(Platform::String ^ deviceId, IIterable<Platform::String ^> ^ additionalProperties, DeviceInformationKind kind);
 static IAsyncOperation<DeviceInformation> CreateFromIdAsync(winrt::hstring const & deviceId, IIterable<winrt::hstring> const & additionalProperties, DeviceInformationKind kind);
[Windows.Foundation.Metadata.Overload("CreateFromIdAsyncWithKindAndAdditionalProperties")]
public static IAsyncOperation<DeviceInformation> CreateFromIdAsync(string deviceId, IEnumerable<string> additionalProperties, DeviceInformationKind kind);
function createFromIdAsync(deviceId, additionalProperties, kind)
Public Shared Function CreateFromIdAsync (deviceId As String, additionalProperties As IEnumerable(Of String), kind As DeviceInformationKind) As IAsyncOperation(Of DeviceInformation)

Parameters

deviceId
String

A string containing the DeviceInformation ID.

additionalProperties
IEnumerable<String>

An iterable list of additional properties to include in the Properties property of the DeviceInformation objects in the enumeration results. For more info on what the properties represent, see Device information properties.

kind
DeviceInformationKind

The type of DeviceInformation object you want to create.

Returns

Attributes

See also

Applies to