Indicates that a new group has been created. Not scriptable.

Syntax

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

Parameters

hr

[in] Success or error code as a LONG. The possible values are:

  • S_OK. A group is successfully added.

  • MSGR_E_GROUP_ALREDY_EXISTS. The name of the group to be added already exists.

  • MSGR_E_GROUP_NAME_TOO_LONG. The name of the group to be added is too long.

  • MSGR_E_BAD_GROUP_NAME. The name of the group to be added is invalid.

pMGroup

[in] Pointer to an IDispatch interface on the IMessengerGroup object that corresponds to the group from which it is created

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 add a contact group to the client contact list. If the hr parameter indicates success, the server has added the contact group. The request to add a contact group to the list 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, this event handler should be used to to trigger the update of the client list.

Example

The example code uses the method parameter, pMGroup, to cast into an IMessengerGroup interface object. This allows the code to access the methods and properties of the interface. The IMessengerGroup::Name property is queried to display the name of the new group in the application console window.

Copy Code
void communicator_OnGroupAdded(
	 int hr, 
	 object pMGroup)
{
   if (hr == 0)
   {
	IMessengerGroup imGroup = (IMessengerGroup)pMGroup;
	StringBuilder sb = new StringBuilder();
	sb.Append(
	 " GROUP ADDED EVENT: hresult" + 
	 formReturnErrors.returnComError(hr));

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

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

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

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