次の方法で共有


Timing a Notification

Applies to: Office 2010 | Outlook 2010 | Visual Studio

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.