IPersistMessage::SaveCompleted
Applies to: Office 2010 | Outlook 2010 | Visual Studio
Notifies the form that a save operation has been completed.
HRESULT SaveCompleted(
LPMESSAGE pMessage
);
Parameters
- pMessage
[in] A pointer to the newly saved message.
Return Value
S_OK
The notification was successful.E_INVALIDARG
The pMessage parameter is NULL and the form is either in the HandsOffFromNormal or HandsOffAfterSave state.E_UNEXPECTED
The form is not in one of the following states:HandsOffFromNormal
HandsOffAfterSave
Remarks
The IPersistMessage::SaveCompleted method is called by a form viewer to notify the form that all pending changes have been saved. SaveCompleted should be called only when the form is in one of the following states:
HandsOffFromNormal
HandsOffAfterSave
NoScribble
Notes to Implementers
There are several possible actions that the SaveCompleted method can perform, depending on what the message pointer parameter contains, and what state the message is in. However, when an action is successful, always save the current state of the message that the pMessage parameter points to and transition the form to its Normal state.
The following table describes the conditions that affect the actions you should take in your implementation of SaveCompleted.
Condition |
Action |
---|---|
The pMessage parameter is NULL and the fSameAsLoad parameter of the IPersistMessage::Save method is set to TRUE. |
Call the IMAPIViewAdviseSink::OnSaved method of all registered viewers, mark the form as clean, and return S_OK. |
The pMessage parameter is NULL and the fSameAsLoad parameter of the IPersistMessage::Save method is set to FALSE. |
Return S_OK. |
The form is in the HandsOffFromNormal state. |
Release the current message and replace it with the message pointed to by the pMessage parameter. Call the replacement message's IUnknown::AddRef method and return S_OK. |
The form is in the HandsOffAfterSave state. |
Call the IMAPIViewAdviseSink::OnSaved method of all registered viewers, mark the form as clean, and return S_OK. |
The form is in the NoScribble state. |
Release the current message and replace it with the message pointed to by pMessage. Call the replacement message's IUnknown::AddRef method. Call the IMAPIViewAdviseSink::OnSaved method of all registered viewers, mark the form as clean, and return S_OK. |
The form is in one of the HandsOff states and the pMessage parameter is set to NULL. |
Return E_INVALIDARG. |
The form is in a state other than one of the HandsOff states or the NoScribble state. |
Return E_UNEXPECTED. |
For more information about saving storage objects, see the documentation for the IPersistStorage::SaveCompleted or IPersistFile::SaveCompleted methods.
See Also
Reference
IPersistStorage::SaveCompleted