Share via


Supporting Formatted Text in Outgoing Messages: Client Responsibilities

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Client applications set the PR_BODY (PidTagBody) property, the PR_RTF_COMPRESSED (PidTagRtfCompressed) property, or the PR_HTML (PidTagHtml) property for an outgoing message. Clients that support only plain text set only the PR_BODY property. Rich Text Format (RTF)-aware clients might set both PR_BODY and PR_RTF_COMPRESSED properties, or only PR_RTF_COMPRESSED, depending on the message store provider being used. HTML-aware clients set the PR_HTML property.

It is important for a client to check its message store's PR_STORE_SUPPORT_MASK (PidTagStoreSupportMask) property to determine whether the store supports RTF. If the message store is not RTF-aware, an RTF-aware client sets both the PR_BODY and PR_RTF_COMPRESSED properties for each outgoing message.

If the message store is RTF-aware, only the PR_RTF_COMPRESSED property needs to be set.

To set PR_RTF_COMPRESSED and ensure that the synchronization process occurs as necessary, RTF-aware clients

  1. Call the IMAPIProp::OpenProperty method to open the PR_RTF_COMPRESSED property, setting both the MAPI_CREATE and MAPI_MODIFY flags. MAPI_CREATE ensures that any new data replaces any old data and MAPI_MODIFY enables you to make those replacements.

  2. Call the WrapCompressedRTFStream function, passing STORE_UNCOMPRESSED_RTF if the message store sets the STORE_UNCOMPRESSED_RTF bit in its PR_STORE_SUPPORT_MASK property, to get an uncompressed version of the PR_RTF_COMPRESSED stream returned from OpenProperty.

  3. Write the message text data to the uncompressed stream returned from WrapCompressedRTFStream.

  4. Commit and release both the uncompressed and compressed streams.

At this point, if the message store provider supports RTF, you have done all that is required. You can depend on the message store provider to handle the synchronization process and the creation of the PR_BODY property, if necessary. However, if the message store provider does not support RTF, you must call the RTFSync function to synchronize the text with the formatting, setting the RTF_SYNC_RTF_CHANGED flag.