Platform SDK: Exchange Server

Saving ANSI Text as a Message Property in RTF

Follow this procedure if the original text contains ANSI characters with no RTF formatting. The purpose of this task is to produce a valid PR_RTF_COMPRESSED property on a message. You must start with a message that does not already contain a PR_RTF_COMPRESSED property. This can be either an existing message or a new message.

To save ANSI text into PR_RTF_COMPRESSED

  1. Open the destination message object with a call to the IMAPIFolder::CreateMessage method (for a new message) or IMAPIFolder::OpenEntry (for an existing message). This call returns an LPMESSAGE pointer to a message object.
  2. Open a stream to the ANSI text to be saved.
  3. Call the HrTextToRTFCompressed function, passing a pointer (LPMESSAGE) to the destination message. This function reads text from the open stream and writes the text to the PR_RTF_COMPRESSED property, simultaneously compressing the text.