Indicates that a contact has been removed from a group. Not scriptable.

Syntax

HRESULT OnContactRemovedFromGroup(
   [in] LONG hr,
   [in] IDispatch* pMGroup,
   [in] IDispatch* pMContact
);

Parameters

hr

[in] Success or error code as a LONG. Possible values are as follows:

  • S_OK. A user is successfully removed from the group.

  • MSGR_E_USER_NOT_FOUND. The user specified to be removed does not exist.

  • MSGR_E_USER_NOT_GROUP_MEMBER. The user specified to be removed does not belong to the group.

  • MSGR_E_GROUP_DOES_NOT_EXIST. The group specified could not be found.

pMGroup

[in] Pointer to an IDispatch interface on the IMessengerGroup object from which the contact was removed.

pMContact

[in] Pointer to an IDispatch interface on the IMessengerContact object that was removed from the group.

Return Value

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

Remarks

This event is used to notify the client application that the Office Communicator server has attempted to remove a contact from a user contact group. If the hr parameter indicates success, the contact has been removed from the specified contact group.

The request to remove a contact from a group is made by the local user but the action is performed by the Office Communicator server. If the client application is keeping a current list of contacts, you should use this event handler to cause the update of the client list.

Example

The following example code displays the name of the contact and group in the application console window. To do this, the code casts the generic object method parameters into the correct IMessengerGroup and IMessengerContact interfaces. Using these interfaces, the code has access to all the methods and properties required. The myContactList object represents a local application custom contact list.

Copy Code
void communicator_OnContactRemovedFromGroup(
	 int hr, 
	 object pMGroup, 
	 object pMContact)
{
	if (hr == 0)
	{
		IMessengerContact imContact = (IMessengerContact)pMContact;
		IMessengerGroup Mgroup = (IMessengerGroup)pMGroup;
		StringBuilder sb = new StringBuilder();
		sb.Append(
		 " CONTACT REMOVED FROM GROUP: ");

		sb.Append(
		 " Group: " +
		 Mgroup.Name);

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

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

		if (myContactList != null)
			myContactList.loadContactList();

}
}

Requirements

Type Description

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

Reference

DMessengerEvents