IMsgStore::SetLockState

The IMsgStore::SetLockState method locks or unlocks a message. This method is called only by the MAPI spooler.

Quick Info

See IMsgStore : IMAPIProp.

HRESULT SetLockState(
  LPMESSAGE lpMessage,   
  ULONG ulLockState      
);
 

Parameters

lpMessage
[in] Pointer to the message to lock or unlock.
ulLockState
[in] Value indicating whether the message should be locked or unlocked. One of the following values are valid:
MSG_LOCKED
The message should be locked.
MSG_UNLOCKED
The message should be unlocked.

Return Value

S_OK
The lock state of the message was successfully set.

Remarks

The IMsgStore::SetLockState method locks or unlocks a message. SetLockState can only be called by the MAPI spooler while it is sending the message.

Usually, when the MAPI spooler calls SetLockState to lock a message, it only locks the oldest message — that is, the next message queued for the MAPI spooler to send. If the oldest message in the queue is waiting for a temporarily unavailable transport provider, and the next message in the queue uses a different transport provider, the MAPI spooler can begin processing the later message. It begins processing by locking that message using SetLockState.

Notes to Implementers

After the MAPI spooler has called SetLockState with the ulLockState parameter set to MSG_LOCKED, calls to IMsgStore::AbortSubmit to cancel the message's transmission must fail.

Call the message's IMAPIProp::SaveChanges method in your SetLockState implementation so that any changes made to the message before the SetLockState call was received are saved.

See Also

IMsgStore::AbortSubmit, IMsgStore::FinishedMsg