Platform SDK: MAPI |
Address book providers support session logon and logoff by implementing the methods of the IABProvider interface. The IABProvider interface inherits directly from IUnknown and adds only two other methods: Logon and Shutdown.
MAPI will call your provider's IABProvider::Logon method at the beginning of every session and whenever your provider is added to the current profile and the client supports dynamic reconfiguration. When MAPI calls the IABProvider::Logon method, your address book provider begins its logon process.
To implement IABProvider::Logon
Note Do not set PR_RESOURCE_FLAGS or PR_PROVIDER_DLL_NAME. At logon time, these properties are read-only.
Because it is possible for MAPI to call your Logon method several times during a session, it is wise to support this possibility in your implementation by being able to create multiple logon objects and keep track of each object that is created. Supporting multiple Logon calls enables a user of a client application, for example, to log on to a session with different identities or use different delivery destinations.
Shutdown is called when the session is ending. MAPI calls your IABProvider::Shutdown method as one of the last tasks involved in shutting down a session. MAPI has released all of your provider's logon objects and, when your provider receives this call, it can assume that this is the last call it will receive. In your implementation of IABProvider::Shutdown, perform any final cleanup that you feel is necessary. For example, your provider might call MAPIDeinitIdle if it has called MAPIInitIdle to use the idle engine during the session or the IUnknown::Release method of any objects that have yet to be released.
If your provider has no final cleanup, its implementation can be made up of a single line of code:
return ResultFromScode(S_OK);