Platform SDK: MAPI

Sharing Simple MAPI Sessions

Workgroup applications should all be able to work from the same profile without presenting logon or profile-selection dialog boxes when each application begins. A MAPI shared session is established once but can be used by other clients. Only one shared session can exist on a given computer at a time. The shared session can be used with any profile. If your client application must use a non-shareable session — that is, your client needs to be guaranteed that no other clients will use its session — then it must use the MAPILogon function in the MAPI API, which has a broader range of functionality than the Simple MAPI logon function.

By default, Simple MAPI attempts to use the shared session if it exists. If no shared session exists, Simple MAPI will create a new shared session when you call MAPILogon. If you log on with the MAPI_NEW_SESSION flag set, then Simple MAPI will create a new shared session regardless of whether one already exists.

The session handles returned to clients using a shared session are not the same. Each client, regardless of whether it is using a unique session or a shared session, has its own unique handle. Session handles are not valid across tasks, even when those handles represent the same shared session.