Retrieves a read-only collection of contacts in the conversation window. Not scriptable.

Syntax

HRESULT Contacts(
   [out,
   retval] IDispatch** pContacts
);

Parameters

pContacts

Address of a pointer to an IDispatch interface on a MessengerContacts object that contains the participants of that conversation, excluding the local user.

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

pContacts is a null pointer.

E_FAIL

The client is not signed in to the primary service at the time this method is called.

S_FALSE

Cannot bring focus to the window.

Remarks

The contact collection returned by this property includes all Office Communicator users who are participating in the current IM conversation. This list includes the local client user. Each contact object in the collection gives you access to the properties and methods of the IMessengerContact interface. Office Communicator Automation API does not prohibit you from adding a contact that is already in the conference. Before adding a new contact, you should iterate on the collection and verify the contact is not already in the conference.

Example

The example code instantiates and fills a contact collection object, contactList as an IMessengerContacts interface object. The Contacts property is queried from the imWindow object and the returned contact collection is iterated over to produce a list of contact friendly names for display on the application console window.

Copy Code
try
{
	StringBuilder sb = new StringBuilder();
	IMessengerContacts contactList =
	(IMessengerContacts)imWindow.Contacts;
	foreach (IMessengerContact contactItem in contactList)
	{
		sb.Append(contactItem.FriendlyName);
		sb.Append(Environment.NewLine);
}
	Console.WriteLine(sb.ToString());
}
catch (COMException CE)
{
	 Console.WriteLine("COM Exception " + CE.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