IPersistMessage::Load

Last modified: July 23, 2011

Applies to: Outlook

Loads the form for a specified message.

HRESULT Load(
  LPMESSAGESITE pMessageSite,
  LPMESSAGE pMessage,
  ULONG ulMessageStatus,
  ULONG ulMessageFlags
);

pMessageSite

[in] A pointer to the message site for the form to be loaded.

pMessage

[in] A pointer to the message for which the form should be loaded.

ulMessageStatus

[in] A bitmask of client-defined or provider-defined flags, copied from the message's PR_MSG_STATUS (PidTagMessageStatus) property, that provide information about the state of the message.

ulMessageFlags

[in] A bitmask of flags, copied from the message's PR_MESSAGE_FLAGS (PidTagMessageFlags) property, that provide further information about the state of the message.

S_OK

The form was successfully loaded.

Form viewers call the IPersistMessage::Load method to load a form for an existing message.

Load is called only when a form is in one of the following states:

If a form viewer calls Load while the form is in any other state, the method returns E_UNEXPECTED.

If your form has a reference to an active message site other than the one that is passed into Load, release the original site because it will no longer be used. Store the pointers to the message site and message from the pMessageSite and pMessage parameters and call both objects' IUnknown::AddRef methods to increment their reference counts.

After AddRef has completed, store the properties from the ulMessageStatus and ulMessageFlags parameters into the form. Transition the form to its Normal state before displaying it, and notify registered viewers by calling their IMAPIViewAdviseSink::OnNewMessage methods.

If no errors occur, return S_OK.

Show: