Last modified: July 23, 2011

Applies to: Outlook

Requests the orderly release of a message store.

HRESULT StoreLogoffTransports(
ULONG FAR * lpulFlags


[in, out] A bitmask of flags that controls how message store logoff occurs. On input, all flags for this parameter are mutually exclusive; only one of the following flags can be set per call:


Any transport provider activity for this store should be stopped before logoff. Control is returned to the client after the activity is stopped and the MAPI spooler has logged off the store. If any transport activity is taking place, the logoff does not occur and no change in the MAPI spooler or transport provider behavior occurs. If there is currently no activity, the MAPI spooler releases the store.


The MAPI spooler should release the store and return control to the client immediately after all outbound mail that is ready to be sent is sent. If the message store has the default Inbox, any in-process message is received, and then further reception is disabled.


The MAPI spooler should release the store and return control to the client immediately after any pending messages are finished processing. No new messages should be processed.


Works the same as the LOGOFF_NO_WAIT flag. The LOGOFF_PURGE flag returns control to the caller after completion.


The logoff should not occur if any transport provider activity is taking place. The type of activity taking place is returned as a flag on output.

On output, MAPI spooler can return one or more of the following flags:


The logoff can complete. All resources associated with the store have been released, and the object has been invalidated. The MAPI spooler has performed or will perform all requests. Only the message store's IUnknown::Release method should be called at this point.


A message is currently coming into the store from one or more transport providers.


A message is currently being sent from the store by one or more transport providers.


There are currently messages in the outbound queue for the store.


The logoff procedure was successful.

The IMAPISupport::StoreLogoffTransports method is implemented for message store provider support objects. Message store providers call StoreLogoffTransports to give client applications some control over how MAPI handles transport provider activity as a message store is closing.

If another process has the store to be logged off open for the same profile, MAPI ignores a call to StoreLogoffTransports and returns the flag LOGOFF_COMPLETE in the lpulFlags parameter.

The behavior of the store provider following the return from StoreLogoffTransports should be based on the value of lpulFlags, which indicates system status and conveys client instructions for logoff behavior.

StoreLogoffTransports is typically called from a store provider's IMsgStore::StoreLogoff method. However, it can also be called from the IUnknown::Release method of the message store. Implement the Release method of your message store so you can check whether or not a call to StoreLogoffTransports has occurred. If a call has not occurred, call StoreLogoffTransports with the LOGOFF_ABORT flag set.

The lpulFlags parameter is set to a flag that indicates how the client requires the message store to be shut down. Determine the appropriate setting for ulFlags based on the setting of the corresponding parameter in the call to StoreLogoff. That is, if a client called your StoreLogoff method with ulFlags set to LOGOFF_ORDERLY, you should call StoreLogoffTransports with ulFlags set to LOGOFF_ORDERLY.

For more information about the message store logoff process, see Shutting Down a Message Store Provider.