Share via


Messenger

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.

The Messenger object is the entry point to using Office Communicator Automation API. An application must first create an instance of this co-class to access the basic Communicator functionality programmatically, including signing in, signing out, querying contacts, adding or removing a contact from the contact lists of the signed-in user, querying and managing presence, and initiating an instant messaging session including voice chat or a phone conversation with a contact.

Remarks

The Messenger object implements the IMessenger3 interface and the DMessengerEvents dispinterface. The IMessenger3 interface inherits from IMessenger2 interface, which in turn inherits from IMessenger interface. Instantiation of a Messenger object is the prerequisite for calling the methods and properties on a running Communicator instance and receiving events from the Communicator instance. A Messenger object can only be an in-process or out-of-process object.

The following remark applies to scriptable languages. Although some scriptable members of the Messenger object deal with user-specific information (for example, a friendly name or sign-in name), user-specific information is never available through script.

Object Information

Class ID

8885370D-B33E-44b7-875D-28E403CF9270

(CLSID_Messenger)

Implemented interfaces

IMessenger3

DMessengerEvents

Instantiation method

Call the CoCreateInstance setting the CLSID parameter to CLSID_Messenger

Header/IDL

Msgrua.h, Msgrua.idl

Versions

Microsoft® Office Communicator Automation API

Operating systems

Microsoft Windows Server® 2003, Windows® XP SP1 or later, or Windows 2000 SP4. Communicator-imposed restrictions apply.

Example

The following code example illustrates the creation of an instance of the Messenger object and the calling of the IMessenger::AutoSignin method on the new object. All further examples in the SDK reference refer to communicator, the instance of Messenger created in this example.

CommunicatorAPI.MessengerClass communicator = new CommunicatorAPI.MessengerClass();
bool connected = false;
int parentHandle = 0;
string account = "jaya@contoso.com";
string passwd = "abc123";
try
{
     communicator.AutoSignin();
     connected = true;
}
catch (ArgumentException AE)
{
    Console.WriteLine(AE.Message.ToString());
}
catch (COMException CE)
{
   Console.WriteLine(CE.ErrorCode.ToString());
}

See Also

Reference

IMessenger
IMessenger2
IMessenger3