IMAPIFolder::CreateMessage
Published: July 16, 2012
Creates a new message.
HRESULT CreateMessage( LPCIID lpInterface, ULONG ulFlags, LPMESSAGE FAR * lppMessage );
You can choose whether to set all of the required message properties in CreateMessage or in the message's IMAPIProp::SaveChanges method. You do not have to make these properties available until a successful save has occurred.
For more information about how to work with associated information, see Folder-Associated Information Tables and Contents Tables.
Some message store providers allow the entry identifier of the new message to be available immediately after CreateMessage returns; other message store providers delay its availability until the message is saved. Because not all message store providers generate an entry identifier for a new message until you have called the message's IMAPIProp::SaveChanges method, you may be unable to access the entry identifier when CreateMessage returns. Also, the new message may not be included in the folder's contents table until the save occurs.
Expect the entry identifier assigned to the new message to be unique not only in the current message store, but most likely across all of the message stores that are open at the same time. One exception to this rule occurs when multiple entries for a message store appear in the profile. This causes the message store to be opened multiple times and entry identifiers to be duplicated.
To create an outgoing message, call the Outbox folder's IMAPIFolder::CreateMessage method.
If you delete a folder that contains a new message before the message is saved, the results are undefined.