Retrieves the phone number information for the contact associated with this IMessengerContact object. Not scriptable.

Syntax

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

Parameters

PhoneType

A member of the MPHONE_TYPE enumerated type.

bstrNumber

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

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.

E_FAIL

The MessengerContact object is not valid; or, the MPHONE_TYPE parameter is invalid.

E_NOTIMPL

Cannot be accessed through scripting.

Remarks

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

E_FAIL HRESULT is returned for a contact that does not have phone information for the specified PhoneType parameter.

Example

The following example code is calling the get_PhoneNumber method on the IMessengerContact object, contact. The parameter of the method call specifies that the returned phone number is the work telephone number. The code displays the returned phone number string on the application console window.

Copy Code
if (contact != null)
{
   try
   {
	Console.WriteLine("Contact Work Phone Number: " + contact.get_PhoneNumber(MPHONE_TYPE.MPHONE_TYPE_WORK));
   }
   catch (COMException CEPN)
   {
	 Console.WriteLine(CEPN.ErrorCode.ToString());
   }
}

Requirements

Client

Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .

Server

Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.

Product

Microsoft Office Communicator 2007 Automation API

IDL file

Msgrua.idl

See Also