Retrieves the name of the service associated with this IMessengerService object. Scriptable.
Syntax
HRESULT ServiceName( [out, retval] BSTR* pbstrServiceName ); |
Parameters
- pbstrServiceName
-
Pointer to a BSTR containing 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.
- RPC_X_NULL_REF_POINTER
-
pbstrServiceName is a null pointer.
- E_FAIL
-
A general failure occurred.
- E_OUTOFMEMORY
-
The internal string copy failed.
Remarks
This method is useful for obtaining human-readable, service-identifying strings to be used in the UI. The IMessenger object property Services returns an IMessengerServices object that is used to obtain a service object. An IMessengerService object can be instantiated from the collection of individual service objects in an IMessengerServices object. Using the IMessengerServices::PrimaryService property of the IMessengerServices object, retrieve the primary communication service.
Example
The example code is using an IMessenger object, communicator, to instantiate an IMessengerServices object, communicatorServices, by retrieving the value of the Services property. The primary communicator service is returned by reading the PrimaryService property of communicatorServices. Finally, the primary service name is displayed in the application console window by retrieving the IMessengerService::ServiceName property value of thisService.
Copy Code | |
---|---|
IMessengerServices communicatorServices; IMessengerService thisService; communicatorServices = (IMessengerServices)communicator.Services; thisService = (IMessengerService)communicatorServices.PrimaryService; if (thisService != null) { try { Console.WriteLine("Primary Service Name: " + thisService.ServiceName; } catch (COMException SNCE) { Console.WriteLine("COM Exception: " + SNCE.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