Providing Notifications for Message Store Providers

While notifications are optional, they are a very important part of a good message store provider. Client applications and the MAPI spooler rely on notifications from the message store provider to get good performance when submitting outgoing messages or receiving incoming messages. Clients and the MAPI spooler can function without receiving notifications from the message store provider but will not be able to inform users of changes in the message store without them. Typically, this means that users will be unable to see that a new message has arrived until their client next opens the message store's receive folder.

Clients register for notifications by calling the IMsgStore::Advise method. The client passes in an IMAPIAdviseSink object, a bitmask indicating what type of notifications the client is interested in receiving, and an EntryID indicating which object in the message store the Advise request applies to. When relevant events occur within the object — for example, when a new message arrives in the receive folder within the message store — the message store provider or the object itself should call the IMAPIAdviseSink::OnNotify method for all of the IMAPIAdviseSink objects that have registered for that event type.

Even if your message store provider never notifies other MAPI components of changes in the message store, it should still implement IMsgStore::Advise to return MAPI_E_NO_SUPPORT. This informs other components not to expect notifications from the message store provider.