Retrieves the primary service name of the logged-on user. Not scriptable.
Parameters
- pbstrServiceName
-
Return value. A pointer to a BSTR that contains the current user's primary service.
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
-
pbstrName is a null pointer.
- E_OUTOFMEMORY
-
The string comparison failed.
- E_FAIL
-
The local client is offline.
Remarks
This service name property represents the name of the communicator service that a user uses when logging on to Office Communicator. Although this property returns the primary service name, best coding practices dictate that you use the IMessengerServices::PrimaryService property of an IMessengerServices object to retrieve the IMessengerService object that represents the primary service a user logs on to. Using the IMessengerService object gives you access to useful functionality and properties not available with an IMessenger object.
Example
Description
The example code reads the MyServiceName property of an IMessenger interface object, communicator. The Service Name string is displayed on the application console window.
Code
Copy Code | |
---|---|
try { string myServiceNameString; myServiceNameString = communicator.MyServiceName; Console.WriteLine("My Service Name: " + myServiceNameString); } catch (COMException MSNCE) { Console.WriteLine(MSNCE.ErrorCode.ToString()); } |