IMAPISupport::PrepareSubmit

Applies to: Outlook 2013 | Outlook 2016

Prepares a message for submission to the MAPI spooler.

HRESULT PrepareSubmit(
LPMESSAGE lpMessage,
ULONG FAR * lpulFlags
);

Parameters

lpMessage

[in] A pointer to the message to prepare.

lpulFlags

[in, out] On input, the lpulFlags parameter is reserved and must be zero. On output, lpulFlags must be NULL.

Return value

S_OK

The message was successfully prepared.

Remarks

The IMAPISupport::PrepareSubmit method is implemented for message store provider support objects. Message store providers call PrepareSubmit in their implementation of the IMessage::SubmitMessage method to prepare a message for submission to the MAPI spooler.

PrepareSubmit is used to handle messages that have the MSGFLAG_RESEND flag set in their PR_MESSAGE_FLAGS (PidTagMessageFlags) property. MSGFLAG_RESEND is set for messages that include a request to be resent when an initial transmission fails. PrepareSubmit determines which of the recipients in the recipient list successfully received the message and which did not.

To access the recipient list, PrepareSubmit calls the message's IMessage::GetRecipientTable method. To retrieve the recipient data, PrepareSubmit calls the recipient table's IMAPITable::QueryRows method. For each row in the table, PrepareSubmit checks the PR_RECIPIENT_TYPE (PidTagRecipientType) property and takes one of the following actions:

  • If the MAPI_SUBMITTED flag is set, PrepareSubmit clears the flag and sets the PR_RESPONSIBILITY (PidTagResponsibility) property to FALSE.

  • If the MAPI_SUBMITTED flag is not set, PrepareSubmit changes PR_RECIPIENT_TYPE to MAPI_P1 and sets PR_RESPONSIBILITY to TRUE.

Notes to callers

Before you call PrepareSubmit, be sure you have called the IMAPISupport::SpoolerNotify method and set the NOTIFY_READYTOSEND flag in the ulFlags parameter. The SpoolerNotify call must be made once per session before the call to PrepareSubmit. SpoolerNotify synchronizes the MAPI spooler and ensures that all needed transport providers are logged on and their address types are registered.

See also

IMAPIFolder::GetMessageStatus
IMessage::SubmitMessage
IMAPISupport : IUnknown