IMessengerContact::PhoneNumber property

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

Retrieves the phone number information for the contact associated with this MessengerContact object.

This property is read-only.

Syntax

HRESULT get_PhoneNumber(
  [in]          MPHONE_TYPE PhoneType,
  [out, retval] BSTR        *bstrNumber
);

Property value

Pointer to a BSTR that contains the returned phone number as a string.

Error codes

Returns one of the following values.

Name Meaning
S_OK
Success.
E_FAIL
MessengerContact object not valid; or, MPHONE_TYPE parameter invalid.
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 Error returned by VARIANT handling library.
0x80070057 Requested an out-of-range property. This is not normally returned through this interface because the API calls a property that is known to be in range.

The bstrNumber return value may contain punctuation. Most APIs used for Internet telephony will either ignore or strip punctuation.

E_FAIL HRESULT will be returned for a contact who does not have phone information for the specified PhoneType parameter.

Note

This property is not 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 btnPhoneNumber_Click()
    On Error Resume Next
    FormPPType.Show vbModal 'Dialog to select phone type
    If bDialogCancel = False Then
        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 Phone = " & CStr(MsgrContact.PhoneNumber(lppType)))
    End If
    ErrorTrap ("Contact.PhoneNumber")   '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

OnContactPagerChange

MyPhoneNumber