Platform SDK: MAPI

Saving a Message in the Inbox

To store a message in the Inbox without any recipients

  1. Call IMsgStore::GetReceiveFolder to retrieve the entry identifier of the Inbox.
  2. Call IMsgStore::OpenEntry to open the Inbox and retrieve a pointer to it.
  3. Call the Inbox's IMAPIFolder::CreateMessage method to create the message.
  4. Call the message's IMAPIProp::SetProps method to add the PR_BODY or PR_RTF_COMPRESSED and PR_SUBJECTproperties.
  5. Create each attachment, set its properties, and save it. For detailed information about adding attachments to messages, see Creating a Message Attachment.
  6. Call IMessage::SaveChanges to save the message. At this point it will appear in the contents table of the Inbox.

If you want to save a message intermittantly before having it appear in the contents table of the Inbox, create it instead in a hidden folder such as the root folder of the IPM subtree and then move it to the Inbox.