IMAPIMessageSite::DeleteMessage

The IMAPIMessageSite::DeleteMessage method deletes the current message.

Quick Info

See IMAPIMessageSite : IUnknown.

HRESULT DeleteMessage(
  LPMAPIVIEWCONTEXT pViewContext,   
  LPCRECT prcPosRect                
);
 

Parameters

pViewContext
[in] Pointer to a view context object.
prcPosRect
[in] Pointer to a RECT structure containing the current form's window size and position. The next form displayed also uses this window rectangle.

Return Values

S_OK
The call succeeded and has returned the expected value or values.
MAPI_E_NO_SUPPORT
The operation is not supported by this message site.

Remarks

A form object calls the IMAPIMessageSite::DeleteMessage method to delete the message the form is currently displaying.

Notes to Callers

Following the return of DeleteMessage, form objects must check for a new message and then dismiss themselves if none exists. To determine whether the message DeleteMessage acted on is deleted or moved to a Deleted Items folder, a form object can call the IMAPIMessageSite::GetSiteStatus method and check if the DELETE_IS_MOVE flag was returned.

Notes to Implementers

If a form viewer's implementation of DeleteMessage moves to the next message after deleting a message, it should call the IMAPIViewContext::ActivateNext method passing the VCDIR_DELETE flag prior to performing the actual deletion. If a form viewer's implementation of DeleteMessage moves the deleted message, for example to a Deleted Items folder, it must save changes to the message if the message has been modified.

A typical implementation of DeleteMessage:

  1. If moving the message, calls the IPersistMessage::Save method passing NULL for its pMessage parameter and TRUE for its fSameAsLoad parameter.
  2. Calls the IMAPIViewContext::ActivateNext method passing the VCDIR_DELETE flag in its ulDir parameter.
  3. If the ActivateNext call fails, it returns. If ActivateNext returns S_FALSE, it calls the IPersistMessage::HandsOffMessage method.
  4. Deletes or moves the message.

To obtain the RECT structure used by a form's window, call the Windows GetWindowRect function.

For a list of interfaces related to form servers, see MAPI Form Interfaces.

See Also

IMAPIMessageSite::GetSiteStatus, IMAPIViewContext::ActivateNext, IPersistMessage::HandsOffMessage, IPersistMessage::Save