Platform SDK: MAPI

Opening Message Text

The text of a message is stored either in its PR_BODY property or PR_RTF_COMPRESSED property. If you support the Rich Text Format (RTF), open PR_RTF_COMPRESSED. If you do not support RTF, open PR_BODY. Because the text of a message can be large regardless of whether or not it is formatted, use IMAPIProp::OpenProperty to open these properties.

To display formatted message text

  1. If you are using a non-RTF aware message store, as indicated by the absence of the STORE_RTF_OK flag in the store's PR_STORE_SUPPORT_MASK property:
    1. Call the message's IMAPIProp::GetProps method to retrieve the PR_RTF_IN_SYNC property.
    2. Call RTFSync to synchronize the message's PR_BODY property with the PR_RTF_COMPRESSED property. Pass the RTF_SYNC_BODY_CHANGED flag if the call to retrieve PR_RTF_IN_SYNC failed because the property does not exist or it is set to FALSE.
    3. If RTFSync returned TRUE — indicating that changes were made — call the message's IMAPIProp::SaveChanges method to permanently store them.
  2. Regardless of whether or not you are using an RTF-aware message store:
    1. Call IMAPIProp::OpenProperty to open the PR_RTF_COMPRESSED property.
    2. If PR_RTF_COMPRESSED is not available, call OpenProperty to open the PR_BODY property.
    3. Call the WrapCompressedRTFStream function to create an uncompressed version of the compressed RTF data, if available.
    4. Copy the formatted text from the stream to the appropriate place in the message form.

To display plain message text

  1. Call the message's IMAPIProp::GetProps method to retrieve the PR_BODY property.
  2. If GetProps returns either PT_ERROR for the property type in the property value structure or MAPI_E_NOT_ENOUGH_MEMORY, call the message's IMAPIProp::OpenProperty method. Pass PR_BODY as the property tag and IID_IStream as the interface identifier.
  3. Copy the plain text from the stream to the appropriate place in the message form.