IMAPIMessageSite::NewMessage
Applies to: Office 2010 | Outlook 2010 | Visual Studio
Creates a new message.
HRESULT NewMessage(
ULONG fComposeInFolder,
LPMAPIFOLDER pFolderFocus,
LPPERSISTMESSAGE pPersistMessage,
LPMESSAGE FAR * ppMessage,
LPMAPIMESSAGESITE FAR * ppMessageSite,
LPMAPIVIEWCONTEXT FAR * ppViewContext
);
Parameters
fComposeInFolder
[in] Indicates in which folder the message should be composed. If the variable is FALSE, the pFolderFocus parameter is ignored and the form viewer can compose the message in any folder. If the variable is TRUE and NULL is passed in the pFolderFocus parameter, the message is composed in the current folder. If the variable is TRUE and a non-NULL value is passed in pFolderFocus, the message is composed in the folder pointed to by pFolderFocus.pFolderFocus
[in] A pointer to the folder where the new message is created.pPersistMessage
[in] A pointer to the form object for the new form.ppMessage
[out] A pointer to a pointer to the new message.ppMessageSite
[out] A pointer to a pointer to a message site object for the new message.ppViewContext
[out] A pointer to a pointer to a view context that is appropriate for passing to a new form with the new message. If the form implements its own view context, NULL can be passed in the ppViewContext parameter.
Return Value
- S_OK
The call succeeded and has returned the expected value or values.
Remarks
Form objects call the IMAPIMessageSite::NewMessage method to create a new message. The form uses NewMessage to get a new message and the associated message site from its view. It can then modify the new message.
You can also obtain an associated view context by passing in a non-NULL value in the ppViewContext parameter. This view context can be used directly, or it can be aggregated and passed to the new message. If a complete implementation is required, pass NULL in ppViewContext.
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::NewMessage |
MFCMAPI uses the IMAPIMessageSite::NewMessage method to create a new message, instantiate a new form viewer, and call SetPersist to set the message on the form viewer. Finally, it returns the form viewer as the message site. |