Skip to main content
ServiceDevice class

Provides methods for identifying a device service for a portable device that supports WPD (Windows Portable Devices) for device enumeration.


var serviceDevice = Windows.Devices.Portable.ServiceDevice;

public static class ServiceDevice

Public NotInheritable Class ServiceDevice

public ref class ServiceDevice abstract sealed 


The ServiceDevice class has these types of members:


The ServiceDevice class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

GetDeviceSelector Returns an Advanced Query Syntax (AQS) string that is used to enumerate device services of the specified ServiceDeviceType. This string is passed to the FindAllAsync or CreateWatcher method.
GetDeviceSelectorFromServiceId An Advanced Query Syntax (AQS) string for identifying a device service by its GUIDs. This string is passed to the FindAllAsync or CreateWatcher method.



To access the device services, you must declare the device service in the capabilities section of the app manifest file. For a list of the GUIDs representing the device services, see Windows.Devices.Portable.

The GetDeviceSelector and GetDeviceSelectorFromServiceId methods get selector strings that are passed to the Windows.Devices.Enumeration API to find portable device services. The Enumerating Common Devices tutorial explains how to use selector strings to discover available devices.

Examples of device services are the Media Transfer Protocol (MTP) device services that allow access to device status, contacts, calendar, tasks, and ringtones on a device. For more information, see MTP Device Services for Windows.

The Portable Device Services Sample demonstrates how to access the device service once you have discovered it.

Note  Access to a device service using this API is only available to Windows Store device apps given privileged access to a device by the device manufacturer. For more information about Windows Store device apps, see Windows 8 Device Experience: Windows Store device apps.

Requirements (Windows 10 device family)

Device family

Desktop, introduced version 10.0.10240.0

API contract

Windows.Devices.Portable.PortableDeviceContract, introduced version 1.0


Windows::Devices::Portable [C++]



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

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported


Windows::Devices::Portable [C++]




[ MarshalingBehavior(Agile)]
[ Threading(Both)]
[ Version(0x06020000)]

See also

Windows 8 Device Experience: Windows Store device apps
Portable Device Services Sample
Enumerating Common Devices