Share via


DMessengerEvents::OnContactStatusChange

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.

Indicates that the status of a contact in the local client's contact list has changed, and returns the current state of the contact. Scriptable.

Syntax

HRESULT OnContactStatusChange(
   [in] IDispatch* pMContact,
   [in] MISTATUS mStatus
);

Parameters

  • pMContact
    [in] Pointer to an IDispatch interface on the IMessengerContact object representing the contact whose status has changed.

    If there is an error, pMContact is null.

  • mStatus
    [in] A member of the MISTATUS enumeration type that specifies the current state of the MessengerContact object.

Return Value

The implementer of this event handler will determine what value should be returned.

Remarks

When a local client user signs in to a service, this event is distributed to all other users that have included the local client in their contact list. The event is also distributed when the local user has changed his status. For example: When the user status changes from Available to Busy, other users are notified of the change by this event. The local user will also receive the event and can use it to verify his status was successfully changed on the Office Communicator server.

The local application will receive these status events from the Office Communicator server for contacts even when those contacts originate on different systems. For example, an Office Communicator user will receive contact status change events from a contact list user who originates from the Windows Live Messenger server.

Example

The example code uses the pmContact parameter to cast into an IMessengerContact interface object. Doing so gives you access to the methods and properties of the interface. The contact name and current status are then written to the application console window.

void communicator_OnContactStatusChange(object pMContact, MISTATUS mStatus)
{
   IMessengerContact imContact = (IMessengerContact)pMContact;
   StringBuilder sb = new StringBuilder();
   sb.Append("CONTACT STATUS CHANGED: Current STATUS-" +
             mStatus.ToString());
   sb.Append("Contact:" + imContact.FriendlyName);
   Console.WriteLine("EVENT: " + sb.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

Reference

IMessengerContact::Status
DMessengerEvents::OnMyStatusChange