Platform SDK: MAPI

Posting a Message

Posting a message is similar to sending a message. The main difference is the destination. Rather than being directed to one or more recipients across one or more messaging systems, a posted message remains in a folder in the current message store.

To post a message

  1. Open the destination folder by calling IMsgStore::OpenEntry. If the destination folder is the Inbox, locate the entry identifier to pass to OpenEntry by calling IMsgStore::GetReceiveFolder.
  2. Call IMAPIFolder::CreateMessage to create the message.
  3. Call the message's IMAPIProp::SetProps method to set:
  4. Call the message's IMAPIProp::SaveChanges method to save the message.
  5. If necessary, create an 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.

Notice that you do not create a recipient list. Instead, you set several properties that are normally set by a transport provider for a sent message.

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.