Freigeben über


IMessengerContact::ServiceName property

[ServiceName is no longer available for use as of Windows Vista. See Windows Messenger for more information.]

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

This property is read-only.

Syntax

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

Property value

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

Error codes

Returns one of the following values.

Name Meaning
S_OK
Success.
E_FAIL
General internal failure.
E_OUTOFMEMORY
Internal string copy failed.
RPC_X_NULL_REF_POINTER
pbstrServiceName is a NULL pointer.
E_NOTIMPL
Cannot be accessed through scripting.

Remarks

The following table lists error codes returned by this method.

Error Code Meaning
0x80004005 General internal failure.
0x8007000E Internal string copy failed.

This method is useful for obtaining human-readable, service-identifying strings to be used in the user interface (UI). The service ID (obtained through ServiceID) will be more useful in the Windows Messenger APIs.

Note

This property is available for scripting languages.

Examples

The following Visual Basic example shows the use of this method.

Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrContact As MessengerAPI.IMessengerContact

Private Sub btnServiceName_Click()
    On Error Resume Next
    Dim strSigninName As String
    Dim strServiceID As String
    'Get selected contact
    strSigninName = ListContact.SelectedItem.SubItems(2)
    strServiceID = ListContact.SelectedItem.SubItems(5)
    Set MsgrContact = Nothing
    Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)
    ErrorTrap ("GetContact")    'Error handling routine
    MsgBox("Contact ServiceName: " & CStr(MsgrContact.ServiceName))
    ErrorTrap ("Contact.ServiceName")   'Error handling routine
End Sub

Requirements

End of client support
Windows XP
End of server support
Windows Server 2003
Header
Msgrua.h
IDL
Msgrua.idl
DLL
Msgsc.dll

See also

IMessengerContact

MyServiceName