Retrieves the unique service identifier (ID) of the contact associated with the selected service. Scriptable.

Syntax

HRESULT ServiceID(
   [out,
   retval] BSTR* pbstrID
);

Parameters

pbstrID

Pointer to a BSTR that contains a string that identifies the service ID used by this contact.

Return Value

Returns one of the following values. For managed code applications, these return values are received in the form of a COMException.

S_OK

Success.

E_FAIL

A general failure occurred.

E_INVALIDARG

pbstrID is a null pointer.

Remarks

This property returns the service ID for the Communicator service specified. The string is formatted as a GUID. This property becomes useful when a user configures multiple services. While the service name might be duplicated within the collection of services, the service ID is unique. Best programming practices dictate that this service ID is used rather than the service name to programmatically identify a specific service.

Example

In this example, an IMessenger object has been instantiated as communicator. The primary communicator service, thisService, is accessed as an IMessengerService object by querying the IMessengerServices::PrimaryService property on communicatorServices. Finally, the Service ID of the user is displayed in the application console window.

Copy Code
IMessengerServices communicatorServices;
IMessengerService thisService;
communicatorServices = (IMessengerServices)communicator.Services;
thisService = (IMessengerService)communicatorServices.PrimaryService;

if (thisService != null)
{
	try
	{
		Console.WriteLine("Primary Service Service ID: " + thisService.ServiceId);
}
	catch (COMException SICE)
	{
		Console.WriteLine("COM Exception: " + SICE.ErrorCode.ToString());
}
}

Requirements

Client

Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .

Server

Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.

Product

Microsoft Office Communicator 2007 Automation API

IDL file

Msgrua.idl

See Also