The information in this article applies to:
SUMMARYWhen registering for MAPI notifications on the Microsoft Exchange Public, Private, or Personal Store, the Advise OnNotify callback function does not get called when you think it should be. MORE INFORMATION
The reason you are not getting notifications can be due to one of four
things:
BackgroundMAPI notifications are used by applications to gather data about MAPI events. Essentially, the application will create what is called an Advise Sink, and register for notifications by calling the Advise() method of the particular MAPI interface it is interested in.Several types of MAPI notifications are available:
There are three different methods of building the actual Advise Sink. The first is fairly easy. Use a single callback function and create the Advise Sink with the Exchange Development Kit (EDK) function HrAllocAdviseSink(). For the lpvContext parameter, pass the pointer to the MAPI interface you want notifications on (example below).
The callback function must also be declared as in the following example:
The second method of creating an Advise Sink is to actually inherit from
IMAPIAdviseSink, and handle the OnNotify member of that class.
The third method is to use Microsoft Foundation Classes' (MFC) OLE interface maps. These must be used from within a class inheriting from CCmdTarget. The form for these macros looks like the following:
Then implement the methods of IMAPIAdviseSink in your CCmdTarget derived
class (AddRef, Release, QueryInterface, and OnNotify). The following
example is of QueryInterface:
For more in-depth information on OLE interface maps, look in the Platform
SDK.
Most MAPI coding difficulties stem from the assumption that all the client code needs to know is the Caller section and that each new provider will work in the same manner as the old familiar ones. The bottom line with MAPI is to always read the documentation for the Implementer as well as the Caller, and to never assume it will always work as expected for every message store provider. As is always the case in MAPI, there are definite caveats when working with the Exchange Server public store as opposed to the private store (where global notifications do work, for instance).
Keywords : |
Last Reviewed: April 30, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |