Retrieves the service ID, a globally unique identifier (GUID), for the contact associated with this IMessengerContact object. The returned value is a string. Scriptable.

Syntax

HRESULT ServiceId(
   [out, retval] BSTR* pbstrServiceID
);

Parameters

pbstrServiceID

Pointer to a BSTR that contains a GUID that uniquely identifies the service 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_INVALIDARG

A general internal failure occurred.

RPC_X_NULL_REF_POINTER

pbstrServiceID is a null pointer.

Remarks

This property always returns the service ID for Microsoft® Office Communications Server.

Example

The following example code is reading the ServiceId property on the IMessengerContact object, contact. The code displays the returned service ID string on the application console window. Because the returned GUID is represented as a string object, it is not necessary to call the ToString() method on the returned value for display.

Copy Code
if (contact != null)
{
   try
   {
	Console.WriteLine("Contact Service ID: " + contact.ServiceId);
   }
   catch (COMException CESI)
   {
	Console.WriteLine(CESI.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