Platform SDK: MAPI

Synchronizing Text and Formatting

The main challenge in sending Rich Text Format (RTF) messages is keeping the text synchronized with the formatting. To ensure that when messages arrive at their destination they are as their originators intended and that the text and formatting are synchronized, MAPI provides the RTFSync function. RTFSync is typically called by RTF-aware clients before displaying incoming messages and by the MAPI spooler when it downloads messages to a transport provider. Callers specify the area of possible discrepancy by passing one or two flags to RTFSync:

The synchronization process that occurs in RTFSync is a sophisticated cyclic redundancy check (CRC) of the message text that ignores some characters and converts others. Characters that most likely were added by transport providers are ignored. MAPI defines several properties for working with RTF as described in the following table.

RTF property Description
PR_RTF_SYNC_BODY_TAG Indicates the beginning of the real message text.
PR_RTF_SYNC_BODY_CRC Contains the result of the cyclic redundancy check of the message text.
PR_RTF_SYNC_BODY_COUNT Contains the number of characters in PR_RTF_SYNC_BODY_CRC.
PR_RTF_IN_SYNC Set to TRUE when the message text and formatting have been synchronized.
PR_RTF_SYNC_PREFIX_COUNT Contains the number of nonwhitespace characters that preceed the message text.
PR_RTF_SYNC_TRAILING_COUNT Contains the number of nonwhitespace characters that trail the message text.