Share via


About the servicesCollection and storagesCollection Objects

The Device object makes available the Services and Storages properties that provide access to a servicesCollection that contains all of the services on a device, and a storagesCollection that contains all of the storages on a device.

These collection objects are used to enumerate the services and storages on the device so that individual Service or Storage objects can be retrieved. Both of these collection objects provide a Count property that returns the number of objects in the collection. The Count property also provides a way to index into the collection to retrieve a specific object.

The servicesCollection object contains all of the services on a device. The servicesCollection object can be accessed through the Services property of the Device object. Specific services in the collection can be retrieved by using a zero-based numeric index, or by using a service Persistent Unique ID (PUID). A PUID is a GUID represented in string form that uniquely identifies a service object on a device.

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

A storagesCollection object contains all of the storages on a device. A storagesCollection object can be accessed through the Storages property. Specific storages in a storagesCollection can be retrieved by using a zero-based numeric index or a PUID.

About the WPD Automation Object Model

Device Object

Service Object

servicesCollection Object

Storage Object

storagesCollection Object