Indicates that a user has been added to the ongoing conversation. Scriptable.

Syntax

HRESULT OnIMWindowContactAdded(
   [in] IDispatch* pContact,
   [in] IDispatch* pIMWindow
);

Parameters

pContact

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

pIMWindow

[in] Pointer to an IDispatch interface on the IMessengerConversationWnd object.

Return Value

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

Remarks

This event is returned when the Office Communicator server has successfully added a user to an ongoing conversation. As a result of adding a user to a conversation, the Office Communicator UI places the user in the Recent Contacts group within the UI. The Recent Contacts group contains the last 10 users that have interacted with the local client user. To make the added user a permanent contact, this event handler should generate a request to the Office Communicator server to add this user as a permanent contact to the local client contact list. See IMessenger::AddContact for more information.

Note: The pContact parameter is cast to the IMessengerContact interface to gain access to the properties necessary to do work. This contact represents a temporary interaction with another user within an IM conversation. This IMessengerContact user object might not be a member of the local client user's contact list. Using the IMessengerContacts collection, an application can determine that the user is not a member of the local client user's contact list. If the user is not in the local user's contact list, this event handler can trigger the adding of the user as a contact in the local users' contacts list.

Example

The event handler displays the HWND of the IM window opened for a conversation and the friendly name of the contact added to the conversation. The two parameters of this event handler must be cast to appropriate interfaces to access the properties needed to display the values in the application console window.

Copy Code
void communicator_OnIMWindowContactAdded(
	 object pContact, 
	 object pIMWindow)
{
	IMessengerConversationWnd imWindow = (IMessengerConversationWnd)pIMWindow;
	IMessengerContact imContact = (IMessengerContact)pContact;
	StringBuilder sb = new StringBuilder();
	sb.Append(
	 " IM WINDOW CONTACT ADDED: window handle-" + 
	 imWindow.HWND);

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

	Console.WriteLine(
		 "EVENT: " + 
		 sb.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