Partager via


Timing a Notification

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.

Because event notification is an asynchronous process, you can be notified at any time, not necessarily immediately after the event has occurred.

The timing of calls to your IMAPIAdviseSink::OnNotify method varies depending on the service provider implementing the advise source. Service providers can notify your client either:

  • Simultaneously with the event.

  • Directly after the event.

  • At some later point following the event, possibly after an Unadvise call.

Most service providers call OnNotify after the MAPI method responsible for the event has returned to its caller. For example, notifications on messages are sent either when changes to the message are saved, after the IMAPIProp::SaveChanges call, or when the message is released, after the IUnknown::Release call. Until the notification is sent, no changes are visible in the message store.

You can receive notifications from an advise source after you have called Unadvise to cancel a registration. Be sure to release your advise sink only after its reference count has fallen to zero, not following a successful Unadvise call. Do not assume that because you have called Unadvise that the advise sink is no longer necessary.