IPersistMessage::Load

Applies to: Outlook 2013 | Outlook 2016

Loads the form for a specified message.

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

Parameters

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.

Return value

S_OK

The form was successfully loaded.

Remarks

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

Notes to implementers

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.

See also

PidTagMessageFlags Canonical Property

PidTagMessageStatus Canonical Property

IPersistMessage : IUnknown

Uninitialized State

HandsOffAfterSave State

HandsOffFromNormal State

Form States

IPersistStorage::Load

IPersistStream::Load

IPersistFile::Load