IMessengerContact::FriendlyName Property

[FriendlyName is no longer available in 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 (get)

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

Parameters

pbstrFriendlyName [out]

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

Return Value

Returns one of the following values: 

Return codeDescription
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 CodeMeaning
0x80004005pbstrFriendlyName returned a NULL string.
0x8007000EString 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

Header

Msgrua.h

IDL

Msgrua.idl

DLL

Msgsc.dll

See Also

IMessengerContact
SigninName
OnContactFriendlyNameChange

 

 

Send comments about this topic to Microsoft

Build date: 6/30/2010

Show: