Retrieves a list of contacts from the group's collection of users. Not scriptable.
Syntax
HRESULT Contacts( [out, retval] IDispatch** ppMContacts ); |
Parameters
- ppMContacts
-
Address of a pointer to an IDispatch interface of an IMessengerContacts object representing the users that are in the group's 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
-
ppMContacts is a null pointer.
- E_OUTOFMEMORY
-
An error occurred during the list creation.
Remarks
When building a custom contact list, this method provides the functionality allowing you to display contacts by group. The local client interface Messenger can be queried for the group collection. In turn, each group is queried for the contacts within the group. Finally, each contact in the collection of contacts is queried for its presence properties. For an example of this method in use, see Building a Custom Contact List.
Example
The following example code assumes the existence of an IMessengerGroup interface object called group. An IMessengerContacts interface object called groupContacts is instantiated. The code iterates on the collection of IMessengerContact objects and displays the contact IMessengerContact::FriendlyName property on the application console.
Copy Code | |
---|---|
try { IMessengerContacts groupContacts = (IMessengerContacts)group.Contacts; foreach (IMessengerContact groupContact in groupContacts) { Console.WriteLine(groupContact.FriendlyName); } } 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