Share via


IMessengerContact::FriendlyName property

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

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

This property is read-only.

Syntax

HRESULT get_FriendlyName(
  [out, retval] BSTR *pbstrFriendlyName
);

Property value

Pointer to a BSTR that contains the friendly name of this user.

Error codes

Returns one of the following values.

Name Meaning
S_OK
Success.
E_FAIL
pbstrFriendlyName returned a NULL string.
E_OUTOFMEMORY
Error returned by VARIANT handling library.
RPC_X_NULL_REF_POINTER
pbstrFriendlyName was a NULL pointer.

Remarks

The following table lists error codes returned by this method.

Error Code Meaning
0x80004005 pbstrFriendlyName returned a NULL string.
0x8007000E String comparison failed.

The friendly name is used in conjunction with the sign-in name primarily for UI display. Because a friendly name is not guaranteed to be unique, it is good practice to display both the sign-in and friendly names for any contact viewed within a client.

Note

This property is available for scripting languages only in a trusted zone.

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 btnFriendlyName_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)
    sbStatus.Panels.Item(1).Text = "Selected: " & strSigninName & " : " & strServiceID
    Set MsgrContact = Nothing
    Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)
    ErrorTrap ("GetContact")    'Error handling routine
    MsgBox("Contact FriendlyName: " & CStr(MsgrContact.FriendlyName))
    ErrorTrap ("Contact.FriendlyName")  '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

SigninName

OnContactFriendlyNameChange