Locating an Information Store
If you do not want to open the default information store in the current profile, you can search for and choose one of the other information stores in that profile. After logging on to a profile and obtaining a session handle, follow the steps in one of the following two procedures. For more information, see the first steps of Opening an Information Store).
To locate an information store using the IMAPISession::GetMsgStoresTable method
-
Call the IMAPISession::GetMsgStoresTable method. This call returns a pointer to a table. Each row in the table corresponds to one of the profile’s information stores.
-
Use the MAPI HrQueryAllRows function to retrieve all rows of the table. Its output parameter pprows points to the returned SRowSet structure, which contains the retrieved table rows.
-
Locate the information store by searching through each row's PR_DISPLAY_NAME property and retrieve that row's PR_ENTRY_ID property. These two properties are on each information store object as columns in the table. For example, the PR_DISPLAY_NAME property is the string that appears in the left pane of the Microsoft Exchange Client. It may contain text such as "Mailbox - Louise Morgan."
-
You can now open the information store using its PR_ENTRY_ID property in a call to the IMAPISession::OpenMsgStore method.
To locate an information store using the HrMAPIFindStore function
-
Call the HrMAPIFindStore function, passing a string that contains the name of the information store. This function returns the PR_ENTRY_ID of the information store object.
-
You can now open the information store using its PR_ENTRY_ID property in a call to the IMAPISession::OpenMsgStore method.
For more information, see Opening an Information Store, Opening a Public Information Store, and Opening a Private Information Store.