Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DeviceInformation.CreateFromIdAsync(String, IIterable(String)) | createFromIdAsync(String, IIterable(String)) method

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

Syntax


Windows.Devices.Enumeration.DeviceInformation.createFromIdAsync(deviceId, additionalProperties).done( /* Your success and error handlers */ );

Parameters

deviceId

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

A string containing the DeviceInformation ID.

additionalProperties

Type: IIterable<String> [JavaScript/C++] | System.Collections.Generic.IEnumerable<String> [.NET]

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 the list of properties in How to retrieve additional properties for a device or PnP object.

Return value

Type: IAsyncOperation<DeviceInformation>

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

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




Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Devices.Enumeration
Windows::Devices::Enumeration [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Devices.Enumeration
Windows::Devices::Enumeration [C++]

Metadata

Windows.winmd

See also

DeviceInformation
CreateFromIdAsync(String)

 

 

Show:
© 2015 Microsoft