Platform SDK: Exchange Server

Opening an Information Store

An application that needs to access an information store must first open it. This action serves as the basis for opening public information stores, working with folders and messages, and other related tasks.

To open an information store

  1. Initialize MAPI, using the MAPIInitialize function. This step loads the MAPI DLLs and sets up entry points into them so that your application can call MAPI functions and methods.
  2. Log on to a MAPI profile, using the MAPILogonEx function. This function call returns an LPSESSION pointer to an IMAPISession object (also know as a session handle). The MAPI profile contains information on services, each of which implements one information store. One of the information stores for the profile is its default information store, which is often the information store you want your application to open.
  3. Select an information store to open. To open the default information store, call the HrMAPIFindDefaultMsgStore function, passing the session handle. This function call returns the entry identifier of the default information store. To select a different information store, see Locating an Information Store.
  4. Open the information store by passing its entry identifier in a call to the IMAPISession::OpenMsgStore method. This call creates the information store object (an LPMDB) and returns a pointer to it.

Note  When making multithreaded IMAPISession::OpenMsgStore calls, the MDB_NO_DIALOG flag should be set.