Handling Notifications

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Notifications enable one object to inform another object that it has undergone a change. The type of change is referred to as an event. MAPI defines several events for which notifications are generated.

Clients typically register for one or more events with one or more objects. These objects are referred to as advise sources. Objects that can act as advise sources include the session object, under MAPI's control, or an object created by a service provider, such as a message. The informed object, referred to as the advise sink, contains either an implementation of the IMAPIAdviseSink : IUnknown interface or the IMAPIViewAdviseSink : IUnknown interface and is within a client application.

Advise source objects implement an Advise method, which is called by clients to register for notifications, and an Unadvise method, which is called to cancel a registration. One of the parameters to Advise is a pointer to an implementation of IMAPIAdviseSink or IMAPIViewAdviseSink. The advise source caches this pointer so that it can call IMAPIAdviseSink::OnNotify or one of the methods in IMAPIViewAdviseSink when a change occurs.

Because receiving notifications enables users to view the most up-to-date information, it is recommended that all clients register for and handle notifications. However, it is optional.

In This Section