IMessengerContact::ServiceName

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Retrieves the service name of the contact associated with this MessengerContact object. Scriptable.

Syntax

HRESULT ServiceName(
   [out,
   retval] BSTR* pbstrServiceName
);

Parameters

  • pbstrServiceName
    Pointer to a BSTR that contains a string that 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_FAIL
    A general internal failure occurred.
  • E_OUTOFMEMORY
    The internal string copy failed.
  • RPC_X_NULL_REF_POINTER
    pbstrServiceName is a null pointer.
  • E_NOTIMPL
    Cannot be accessed through scripting.

Remarks

This method is useful for obtaining human-readable, service-identifying strings to be used in the UI. The service ID (obtained through IMessengerContact::ServiceId property) is more useful in Office Communicator Automation API.

Example

The example code is reading the ServiceName property of the IMessengerContact object and displaying the returned string value on the application console window.

if (contact != null)
{
   try
   {
      Console.WriteLine("Contact Service Name: " + contact.ServiceName);
   }
   catch (COMException CESN)
   {
     Console.WriteLine (CESN.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

Concepts

IMessenger::MyServiceName