Using Event Notifications

Event notification is the communication of information between two MAPI objects. One object registers an interest in learning of a change or error, called an event, that may take place in another object. After the event occurs, the first object is informed, or notified. The object receiving the notification is called the advise sink; the object responsible for the notification is called the advise source. MAPI advise sink objects implement the IMAPIAdviseSink interface, which contains a single method, OnNotify. The advise source notifies the advise sink by calling OnNotify and passing a notification structure that contains information about the event. OnNotify can perform tasks in response to the notification, such as updating data in memory or refreshing a screen display.

Client applications typically implement advise sink objects and service providers implement the advise source. Unlike the advise sink, which is a particular type of MAPI object, the advise source may be one of the many different types of MAPI objects that supports event notification. To name a few, advise source objects include sessions, tables, message stores, address book objects, and folders. All advise source objects contain the Advise and Unadvise methods to handle notification registration. Clients call Advise when they want to register for a notification and Unadvise when they want to cancel the registration.

For more information on the tasks required to implement notifications, see the MAPI Programmer's Reference.

There are two major kinds of notifications: object notifications and table notifications. The following sections provide information on using these types of notifications in your application.