Indicates that the phone information of a contact in the local client's contact list has changed.

Syntax

HRESULT OnContactPhoneChange(
   [in] LONG hr,
   [in] IDispatch* pContact,
   [in] MPHONE_TYPE PhoneType,
   [in] BSTR bstrNUmber
);

Parameters

hr

[in] Success or error code as a LONG.

An error result for hr might result in all other event parameters being null or otherwise invalid. Always check for a successful hr before attempting to use the other event parameters.

pContact

[in] Pointer to an IDispatch interface on the IMessengerContact object that corresponds to the contact.

PhoneType

[in] A value in the MPHONE_TYPE enumeration.

bstrNUmber

[in] A BSTR that contains the string of the phone number.

Return Value

The implementer of this event handler will determine what value should be returned.

Remarks

The bstrNumber string might contain punctuation. In general, punctuation is useful for display in the UI but not for APIs that handle telephony. Clients can strip punctuation out of the returned string by parsing. The parsed string can be used by the API but the original string should be retained by the application for display. Unless your application has been localized for a set of punctuation conventions, it is not possible to add correct punctuation to the parsed string.

Example

The example code creates IMessengerContact object from the event arguments by casting the object into the appropriate types. After casting, all the methods and properties of the types are available. The friendly name, phone number type, and telephone number are displayed in the application console window.

Copy Code
void communicator_OnContactPhoneChange(
	 int hr, 
	 object pContact, 
	 MPHONE_TYPE PhoneType, 
	 string bstrNumber)
{
	if (hr == 0)
	{
		IMessengerContact imContact = (IMessengerContact)pContact;
		StringBuilder sb = new StringBuilder();
		sb.Append(
		 " CONTACT PHONE CHANGED: HRESULT-" +
		 formReturnErrors.returnComError(hr));

		sb.Append(
		 " Contact:" +
		 imContact.FriendlyName);

		sb.Append(
		 PhoneType.ToString() +
		 " NUMBER: " +
		 bstrNumber);

		Console.WriteLine(
			 "EVENT: " +
			 sb.ToString());

		myContactList.updateContactStatus(
					imContact,
					imContact.Status);
}
 }

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