Retrieves the number of groups in a IMessenger object. Not scriptable.

Syntax

HRESULT Count(
   [out,
   retval] LONG* pcCount
);

Parameters

pcCount

Pointer to a LONG that provides the number of IMessengerGroup objects in the collection.

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.

RPC_X_NULL_REF_POINTER

pcGroups is a null pointer.

Remarks

This collection of IMessengerGroup objects returned by the MyGroups property is zero based. If there is one group in the collection, the count returned is 1 while the index value to refer to that group is 0.

Example

The example code instantiates an IMessengerGroups object, localGroups to hold the value of the IMessenger2::MyGroups property on the Messenger object, communicator. The number of groups in the collection is displayed on the application console with the value of the Count property.

Copy Code
IMessengerGroups localGroups = (IMessengerGroups)communicator.MyGroups;
try
{
  if (localGroups != null)
  {
	 IMessengerGroup lastGroup = (IMessengerGroup)localGroups.Item(localGroups.Count - 1);
	 Console.WriteLine("Number of Groups: " + 
						localGroups.Count +
						" Last Group Name: " +
						lastGroup.Name
					);
  }
}
catch (COMException CCE)
{
   Console.WriteLine(CCE.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

Reference

IMessengerGroups