Platform SDK: MAPI

IMAPISession::SetDefaultStore

The IMAPISession::SetDefaultStore method establishes a message store as the default message store for the session.

Quick Info

See IMAPISession : IUnknown.

HRESULT SetDefaultStore(
  ULONG ulFlags,       
  ULONG cbEntryID,     
  LPENTRYID lpEntryID  
);
 

Parameters

ulFlags
[in] Bitmask of flags that controls the setting of the default message store. These flags are mutually exclusive; only one of the following flags can be set:
MAPI_DEFAULT_STORE
Establishes the message store as the session default. Updates the message store's status table row by setting the STATUS_DEFAULT_STORE flag in the PR_RESOURCE_FLAGS column.
MAPI_PRIMARY_STORE
Establishes the message store as the store to be used at logon. If the message store is not the default store, clients should make it the default. Updates the message store's status table row by setting the STATUS_PRIMARY_STORE flag in the PR_RESOURCE_FLAGS column.

MAPI_SECONDARY_STORE

Establishes the message store as the store to be used at logon if the primary message store is not available. If a client cannot open the primary store, it should open the secondary store and set it as the default. Updates the message store's status table row by setting the STATUS_SECONDARY_STORE flag in the PR_RESOURCE_FLAGS column.

MAPI_SIMPLE_STORE_PERMANENT
Establishes the message store as the session default for Simple MAPI and CMC clients and sets the STATUS_SIMPLE_STORE flag in the message store's PR_RESOURCE_FLAGS property in its status table row, message store table row, and in the session profile.
MAPI_SIMPLE_STORE_TEMPORARY
Establishes the message store as the session default for Simple MAPI and CMC clients and sets the STATUS_SIMPLE_STORE flag in the message store's PR_RESOURCE_FLAGS property in its status table row and message store table row. The profile is not modified.
cbEntryID
[in] Count of bytes in the entry identifier pointed to by the lpEntryID parameter.
lpEntryID
[in] Pointer to the entry identifier of the message store intended as the default. If a client passes NULL in lpEntryID, no message store is selected as the default.

Return Values

S_OK
The call succeeded and has returned the expected value or values.

Remarks

The IMAPISession::SetDefaultStore method establishes a message store as one of the following:

To establish a message store as the default, the message store must have the following flags set in its PR_STORE_SUPPORT_MASK property:

STORE_SUBMIT_OK

STORE_CREATE_OK

STORE_MODIFY_OK

Notes to Callers

You can determine the default message store for the session by retrieving the status table and searching for the setting of the STATUS_DEFAULT_STORE flag in the PR_RESOURCE_FLAGS column. The row with this setting represents the message store designated as the session default.

When either the MAPI_DEFAULT_STORE or the MAPI_SIMPLE_STORE_PERMANENT flag is set, MAPI updates the profile, message store table, and status table.

Whenever a change is made to the message store default setting, the following notifications are generated:

See Also

PR_RESOURCE_FLAGS, PR_STORE_SUPPORT_MASK, TABLE_NOTIFICATION