The IMAPIStatus::FlushQueues method forces all messages waiting to be sent or received to be immediately uploaded or downloaded.
HRESULT FlushQueues(
ULONG ulUIParam,
ULONG cbTargetTransport,
LPENTRYID lpTargetTransport,
ULONG ulFlags
);
The IMAPIStatus::FlushQueues method requests that the MAPI spooler or a transport provider immediately send all messages in the outbound queue or receive all messages from the inbound queue. FlushQueues is only implemented by the MAPI spooler status object and by status objects supplied by transport providers.
The processing involved with FlushQueues can take a long time. By default, the MAPI spooler's implementation displays a progress indicator to keep the user informed. If the FLUSH_NO_UI flag is set in the ulFlags parameter, no progress indicator is displayed. Transport providers never display a progress indicator as part of their flush operation; they always ignore the FLUSH_NO_UI flag.
MAPI_E_BUSY should be returned for asynchronous requests so that clients can continue work.
By default, FlushQueues is a synchronous operation; control does not return to the caller until the flush has completed. Only the flush operation performed by the MAPI spooler can be asynchronous; clients request this behavior by setting the FLUSH_ASYNC_OK flag.
A remote transport provider's implementation of FlushQueues sets bits in the PR_STATUS_CODE property in the logon object's status row to control how queues are flushed. If a remote viewer passes in the FLUSH_UPLOAD flag, the FlushQueues method should set the STATUS_INBOUND_ENABLED and STATUS_INBOUND_ACTIVE bits. If a remote viewer passes in the FLUSH_DOWNLOAD flag, the FlushQueues method should set the STATUS_OUTBOUND_ENABLED and STATUS_OUTBOUND_ACTIVE bits. FlushQueues should then return S_OK. The MAPI spooler will then initiate the appropriate actions to upload and download messages.
When calling the MAPI spooler status object, this is a directive to transfer all messages either to or from the appropriate transport provider. When calling an individual transport provider's status object, only the messages for that provider are affected.