Retrieves the number of IMessengerService objects in the collection. Scriptable.

Syntax

HRESULT Count(
   [out,
   retval] long* pcServices
);

Parameters

pcServices

Pointer to a LONG that provides the number of MessengerServices 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

pcServices is a null pointer.

Remarks

If there are no active IMessengerService objects, pcServices returns zero.

If this method is called while the client is offline, the method call does not fail.

Example

The following code example examines the IMessengerServices::Count property on the IMessengerServices object, communicator, to get the count of Communicator service objects in the collection. The number of collection items is displayed in the application console window.

Copy Code
IMessengerServices serviceCollection;
serviceCollection = (IMessengerServices)communicator.Services;
if (serviceCollection.Count > 0 && serviceCollection != null)
{
   try
   {
	Console.WriteLine(serviceCollection.Count.ToString());
   }
   catch (COMException SCCE)
   {
	 Console.WriteLine("COM Exception " + SCCE.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