Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 2.47 KB

deviceinformation_createfromidasync_907774063.md

File metadata and controls

50 lines (39 loc) · 2.47 KB
-api-id -api-type
M:Windows.Devices.Enumeration.DeviceInformation.CreateFromIdAsync(System.String,Windows.Foundation.Collections.IIterable{System.String})
winrt method

Windows.Devices.Enumeration.DeviceInformation.CreateFromIdAsync

-description

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

-parameters

-param deviceId

A string containing the DeviceInformation ID.

-param additionalProperties

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

An object for starting and managing the asynchronous creation of the DeviceInformation object.

-remarks

-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)