Lost link in NotesRichTextItem

Hi, I would like to add a text before paragraph with text and doc link. But, I lost the doc link, and have only the text.

Dim eDoc As NotesDocument

Dim rtitemA As Variant

Dim rtitemB As Variant

Dim rtitemC As Variant

Set rtitemA = eDoc.GetFirstItem(“Body”)

rtitemB.values = “An error occurred and the AES Xcell system could not notify " + + eDoc.SendTo(0) + " . Please forward this email to him” + Chr$(13) + Chr$(13)

Call rtitemB.AddNewLine( 2, True )

Set rtitemC = rtitemB

Call rtitemC.AppendRTItem(rtitemA)

Set rtitemA = rtitemC

Dim item As NotesItem

Set item = eDoc.ReplaceItemValue(“Body”, rtitemA.Values)

or

Dim rtitemA As New NotesRichTextItem(eDoc,“BodyOld”)

Call rtitemA.AppendText( “An error occurred and the AES Xcell system could not notify " + + eDoc.SendTo(0) + " . Please forward this email to him” )

Set rtitemB = eDoc.GetFirstItem(“Body”)

Call rtitemA.AppendRTItem(rtitemB)

Dim item As NotesItem

Set item = eDoc.ReplaceItemValue(“Body”, rtitemA.Values)

Do you have an idea why it’s not working?

P.S.

When I’m trying this:

Set rtitemA = eDoc.GetFirstItem(“Body”)

Call rtitemA.AddNewLine( 2, True )

Dim test As String

test = “An error occurred and the AES Xcell system could not notify " + + eDoc.SendTo(0) + " . Please forward this email to him”

Call rtitemA.AppendText( “An error occurred and the AES Xcell system could not notify " + + eDoc.SendTo(0) + " . Please forward this email to him” )

I have the doc ling and the new line at the end…

Thanks

Subject: Lost link in NotesRichTextItem

Where is the AppendDocLink call?

Subject: RE: Lost link in NotesRichTextItem

The AppendDocLink was set in the eDoc passed in parameter before. But, we found a solution when we use this:

If (Cstr(Err) = 4295)  Then

	Dim s As New NotesSession

	Dim Db As NotesDatabase

	Dim nEmaildoc As NotesDocument	

	Dim rtnav As NotesRichTextNavigator

	Dim rtrange As NotesRichTextRange

	Dim rtitemA As NotesRichTextItem

	Dim richStyle As NotesRichTextStyle

	

	Set db = s.CurrentDatabase

	Set rtitemA = eDoc.GetFirstItem("Body")

	Set rtnav = rtitemA.CreateNavigator

	Set richStyle = s.CreateRichTextStyle

	richStyle.Bold = True

	

	If rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then

		Call  rtitemA.BeginInsert(rtnav,False)

		Call rtitemA.AppendStyle(richStyle)

		Call rtitemA.AppendText("An error occurred and the AES Xcell system could not notify " +  + eDoc.SendTo(0) + " . Please forward this email to him")

		Call rtitemA.addnewline(2)

		Call rtitemA.AppendText("------------------------------------------------------------------------------------------------------------------------------------------------------------------")

		Call rtitemA.addnewline(2)

		richStyle.Bold = False

		Call rtitemA.AppendStyle(richStyle)

		Call rtitemA.EndInsert 

	End If

Subject: RE: Lost link in NotesRichTextItem

Your original problem was that you were using ReplaceItemValue(), which turned the NotesRichTextItem into a NotesItem (just a text field).