Microsoft KB Archive/264610

= PRB: CDO Text Property Does Not Accept CR or LF =

Article ID: 264610

Article Last Modified on 3/11/2004

-

APPLIES TO


 * Microsoft Exchange Server 5.5 Service Pack 4
 * Microsoft Exchange Server 5.5 Standard Edition
 * Microsoft Exchange Server 5.5 Service Pack 1
 * Microsoft Exchange Server 5.5 Service Pack 2
 * Microsoft Exchange Server 5.5 Service Pack 3
 * Microsoft Collaboration Data Objects 1.2
 * Microsoft Collaboration Data Objects 1.21
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q264610



SYMPTOMS
When you append a new line of text to an item's Text property and use a carriage return (CR) and/or line feed (LF) to force them to separate lines, the Text property ignores the CR and LF.



CAUSE
The Exchange store's Rich Text Format (RTF) synchronization routine groups the existing and appended text in an attempt to preserve any RTF formatting of the existing text. When checking for the existing text, it ignores changes that are white space only; for example, additional line wrapping. In this case, the CR/LF pair is recognized as a part of the existing text, and only the text that follows it is considered to be appended.



RESOLUTION
The workaround is to remove the item's CdoPR_RTF_COMPRESSED property before appending to the Text property, as illustrated by the following Visual Basic code: With objMyAppt 'Delete the PR_RTF_COMPRESSED property so that 'RTF synchronization does not take place. .Fields(CdoPR_RTF_COMPRESSED).Delete

.Text = .Text & vbCrLf & &quot;(Line 2) Drive safely!&quot; .Update End With



STATUS
This behavior is by design.



Steps to Reproduce Behavior
'NOTE: Assumes your project includes a reference to '     &quot;Microsoft CDO 1.21 Library&quot;.

Dim objSession As MAPI.Session Dim objCalendar As MAPI.Folder Dim objMyAppt As MAPI.AppointmentItem

Set objSession = CreateObject(&quot;MAPI.Session&quot;) objSession.Logon

Set objCalendar = objSession.GetDefaultFolder(CdoDefaultFolderCalendar) Set objMyAppt = objCalendar.Messages.Add

With objMyAppt 'Add the first line. .Subject = &quot;Test appointment&quot; .Location = &quot;Downtown&quot; .Text = &quot;(Line 1) Go for a drive.&quot; .Update MsgBox Prompt:=.Text, Title:=&quot;Before updating&quot;

'Add the second line. .Subject = &quot;Updated test appointment&quot; .Text = .Text & vbCrLf & &quot;(Line 2) Drive safely!&quot; .Update MsgBox Prompt:=.Text, Title:=&quot;After updating&quot; End With

'Log off and clean up. objSession.Logoff Set objMyAppt = Nothing Set objCalendar = Nothing Set objSession = Nothing

Keywords: kbmsg kbprb KB264610

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.