servicesCollection object

The servicesCollection object represents a collection of Service objects.

Members

The servicesCollection object has these types of members:

Properties

The servicesCollection object has these properties.

PropertyAccess typeDescription

Count

Read-only

Gets the number of Service objects in the collection.

 

Remarks

A servicesCollection object that contains all of the services on a device can be accessed through the Device.Services property. Specific services in the Device.Services collection can be retrieved by using either a zero-based numeric index or a Service Persistent Unique ID (PUID).

A servicesCollection object that is filtered by service type can be retrieved using the Device.GetServicesByType method. The services in a servicesCollection obtained from this method can only be accessed by a zero-based numeric index.

Examples

The following JScript example shows how to create a servicesCollection and enumerate the services in the collection, accessing them by index.


// Retrieve a collection of services from the device.
var services = deviceObject.GetServicesByType("ServiceTypeGUID");

// Enumerate the services in the collection and access them by index.
for (i=0; i < services.Count; i++)
{
    var aService = services[i]; 
}

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

See also

About the servicesCollection and storagesCollection Objects
Device Object
Service Object
WPD Automation Reference

 

 

Community Additions

ADD
Show:
© 2014 Microsoft