This documentation is archived and is not being maintained.


This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Retrieves the contact list that is contained in the client or Messenger object. The retrieved list is a MessengerContacts collection object that can be manipulated with the IMessengerContacts interface. It can be called from a script not running inside a Web page.

HRESULT MyContacts(
   retval] IDispatch** ppMContacts


Return value. Pointer to a pointer to an IDispatch interface. Returns the IMessengerContacts interface on the contact list or MessengerContacts collection object.

Returns one of the following values. For managed code applications, these return values are received in the form of a COMException.


Success. See Remarks.


ppMContacts is a null pointer.


An error occurred during the list creation.

ppMContacts should be released when it is no longer needed. Retrieved lists can potentially have zero members in their collection.

If this method is called while the client is not signed in, S_OK is still the HRESULT and a true object is returned. However, the resulting MessengerContacts collection object has zero members.

This example code instantiates an IMessengerContacts object and makes a request on the IMessenger object communicator to receive a contact list by calling the IMessenger::MyContacts method. Finally, the code iterates on the contact collection to display each individual contact's friendly name on the application console. For more information about the properties and methods available on a contact, see IMessengerContact.

if (communicator != null)
   IMessengerContacts myContacts;
       myContacts = (IMessengerContacts)communicator.MyContacts;
       if (myContacts != null)
           foreach (IMessengerContact myContact in myContacts)
              Console.WriteLine("Contact: " + myContact.FriendlyName);
   catch (COMException CLCE)


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. .


Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.


Microsoft Office Communicator 2007 Automation API

IDL file