Opening the Default Message Store

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

In any particular session, one message store acts as the default message store. A default message store has the following characteristics:

  • The PR_DEFAULT_STORE (PidTagDefaultStore) property is set to TRUE.

  • The STATUS_DEFAULT_STORE flag is set in the PR_RESOURCE_FLAGS (PidTagResourceFlags) property.

  • MAPI automatically creates the IPM subtree and the root folders for search-results, common views and personal views when the message store is opened. For more information about these folders, see IPM Subtree and MAPI Special Folders.

To retrieve the entry identifier for the default message store, you must call IMAPISession::GetMsgStoresTable to open the message store table and apply an appropriate restriction in a call to HrQueryAllRows. HrQueryAllRows will return a row set with the one row that represents the default message store. The restriction that you pass to HrQueryAllRows can take on one of the following forms:

  1. An AND restriction that uses an SAndRestriction structure to combine:

    • An exists restriction that uses an SExistRestriction structure to test for the existence of the PR_DEFAULT_STORE property.

    • A property restriction that uses an SPropertyRestriction structure to check for the TRUE value in the PR_DEFAULT_STORE property.

  2. A bitmask restriction that uses an SBitMaskRestriction structure for applying STATUS_DEFAULT_STORE as a mask against the PR_RESOURCE_FLAGS property.

See Also

Reference

SExistRestriction

SAndRestriction