Platform SDK: MAPI

IPersistMessage::Save

The IPersistMessage::Save method saves a revised form back to the message from which it was loaded or created.

Quick Info

See IPersistMessage : IUnknown.

HRESULT Save(
  LPMESSAGE pMessage,   
  ULONG fSameAsLoad     
);
 

Parameters

pMessage
[in] Pointer to the message.
fSameAsLoad
[in] Value that is set to TRUE if the message pointed to by pMessage is the message from which the form was loaded or created, and FALSE otherwise.

Return Values

S_OK
The form was successfully saved.

Remarks

Form viewers call the IPersistMessage::Save method to save a revised form back to the message from which it was loaded or created.

Save should only be called when the form is its Normal state.

Notes to Implementers

Do not commit the saved changes; it is up to the caller to perform the commit. Never make changes to the properties belonging to the form's message except during the Save call.

If fSameAsLoad is set to TRUE, you can save the changes to the form's existing message. If fSameAsLoad is set to FALSE, you must copy all of the properties from the original message into the message pointed to by pMessage before performing the save. Use the original message's IMAPIProp::CopyTo method to copy the properties.

When all of the properties have been copied, enter the No Scribble state. If no errors occur, return S_OK. Otherwise, return the error from the failed action.

If Save is called when the form is in any state other than Normal, return E_UNEXPECTED.

For more information on saving storage objects, see the documentation on the IPersistStorage methods in the OLE Programmer's Reference.