IMAPIMessageSite::GetMessage

Applies to: Outlook 2013 | Outlook 2016

Returns the current message.

HRESULT GetMessage(
  LPMESSAGE FAR * ppmsg
);

Parameters

ppmsg

[out] A pointer to a pointer to the returned interface for the message.

Return value

S_OK

The call succeeded and has returned the expected value or values.

S_FALSE

No message currently exists for the calling form.

Remarks

Forms call the IMAPIMessageSite::GetMessage method to obtain a message interface for the current message. The current message is the same message as was previously passed in the IPersistMessage::InitNew, IPersistMessage::Load, or IPersistMessage::SaveCompleted method.

GetMessage returns S_FALSE if no message currently exists. This state can occur after calls to the IPersistMessage::HandsOffMessage method or before the next call to IPersistMessage::Load or IPersistMessage::SaveCompleted is made.

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

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
MyMAPIFormViewer.cpp
CMyMAPIFormViewer::GetSession
MFCMAPI uses the IMAPIMessageSite::GetMessage method to return the currently cached message pointer, if it is available.

See also

IPersistMessage::HandsOffMessage

IPersistMessage::InitNew

IPersistMessage : IUnknown

IPersistMessage::Load

IPersistMessage::SaveCompleted

IMAPIMessageSite : IUnknown

MFCMAPI as a Code Sample

MAPI Form Interfaces