IMAPIAdviseSink::OnNotify

Send Feedback

The OnNotify method responds to a notification by performing one or more tasks, which depend on the object generating the notification, and type of event.

Syntax

ULONG OnNotify(
  ULONG cNotif,
  LPNOTIFICATION lpNotifications 
);

Parameters

  • cNotif
    [in] Ignored*.*
  • lpNotifications
    [in] Reference to one NOTIFICATION structure that provides information about the events that have occurred.

Return Value

OnNotify returns the ULONG value 0 on success. Any nonzero ULONG value indicates failure.

Remarks

The notification process begins when a client or MAPI makes a call to a service provider's IMAPISession::Advise method to register to receive a notification of a particular type for a particular object. One of the parameters to the Advise method is a pointer to an advise sink object that implements IMAPIAdviseSink. When an event occurs for the target object that corresponds to the registered notification, the service provider, either directly or indirectly through MAPI, calls the advise sink's OnNotify method.

The call to OnNotify can occur either during the MAPI call that is causing the event or at some later time. On systems that support multiple threads of execution, OnNotify can be called either on the same thread that was used for registration or on a different thread. The lpNotifications parameter points to a NOTIFICATION structure, which describes what changed during the event.

When changes occur to multiple objects, you can notify a registered advise sink in a single call to OnNotify or in multiple calls. For example, a call to IMAPIFolder::CopyMessages can affect multiple messages and folders. As a message store provider, you can make one call to OnNotify with an fnevObjectModified event type for the target folder, or you can make one call for each of the affected messages. Similarly, repeated client calls to IMAPIFolder::CreateMessage can be combined into one fnevObjectModified event for the folder or separated into individual fnevObjectCreated events for each of the new messages.

Requirements

Pocket PC: Pocket PC 2002 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: cemapi.h
Library: cemapi.lib

See Also

IMAPIAdviseSink | Messaging

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.