Retrieves a specific IMessengerGroup object by numeric index. Not scriptable.

Syntax

HRESULT Item(
   [in] LONG Index,
   [out,
   retval] IDispatch** ppMGroup
);

Parameters

Index

[in] LONG that specifies the index of the desired MessengerGroup object in the collection.

ppMGroup

[out, retval] Address of a pointer to the IDispatch interface on a MessengerGroup object requested with IDispatch interface on an Index. The object can now be accessed through the IMessengerGroups interface.

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.

E_FAIL

The invalid collection or index number provided exceeds the length of the collection.

RPC_X_NULL_REF_POINTER

ppMGroup is a null pointer.

E_INVALIDARG

The index is not a positive integer.

Remarks

The collection of IMessengerGroup objects is a zero-based array. When you use the Item method to reference one of these objects in the collection, you must take this into account. For example, to refer to the first object in the collection, the int value 0 is passed into the Item method.

Example

The following example code instantiates and fills an IMessengerGroups collection and fills it by querying the IMessenger2::MyGroups property of the communicator object.

Copy Code
try
{
   IMessengerGroups theseGroups =
				 (IMessengerGroups)communicator.MyGroups;
   IMessengerGroup thisGroup = 
				(IMessengerGroup)theseGroups.Item(theseGroups.Count-1);
   if (thisGroup != null)
   {
	 resultsText.Text = thisGroup.Name.ToString().Trim() +
						thisGroup.Service.ToString();
   }
}
catch (COMException ICE)
{
	resultsText.Text = formReturnErrors.returnComError(ICE.ErrorCode);
}

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