Compartilhar via


Canceling 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.

To cancel a notification, clients call an advise source's Unadvise method. Calling Unadvise is important because it causes the service provider to release its reference to your advise sink. As long as a service provider maintains a reference to an advise sink, the advise sink can continue to receive IMAPIAdviseSink::OnNotify calls. In fact, because of the asynchronous nature of event notification, clients can be notified even after a successful Unadvise call. Clients must be able to handle the receipt of notifications at any time.

Because service provider implementations differ, clients that fail to call Unadvise to cancel a notification cannot assume anything about when a provider will release its reference to their advise sink. Some service providers release their references to advise sinks when they release their advise sources. Some service providers do not. As long as a service provider maintains a reference to an advise sink, that advise sink can continue to receive notifications.