Hello,
I wrote a code to insert some text into a “Body” field of a mail document. It is intended to insert something (in our case a small mail disclaimer) just before the “Lotus Notes Memo” section of a Reply-with-history memo.
To do that, I use the following code:
’ ----------------------------------------------------------------
[…]
Dim doc as NotesDocument
Dim uidoc as NotesUIDocument
Dim body As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
[… setting uidoc …]
set doc = uidoc.document
dim body as NotesRichTextItem
Set body = doc.GetFirstItem(“Body”)
Set rtnav = body.CreateNavigator
If rtnav.FindFirstElement (RTELEM_TYPE_SECTION) Then
Call body.BeginInsert(rtnav, False)
Call body.AppendText (".....Disclaimer.....")
Call body.EndInsert
End If
[…]
’ ----------------------------------------------------------------
This works in most of the cases and the disclaimer text is inserted at just the right position.
Now I encountered a mail which I received trough the internet. It is filled with normal text, a picture, some URL links to internet pages and so on.
When I reply to this one, the disclaimer text is not inserted before the “Lotus Notes Memo” section but inside the section just behind the picture. The funny thing is that even in this memo the section is found correctly. I tested it with a simple
Messagebox rtnav.GetElement.Title
just behind the FindFirstElement and it showed “Lotus Notes Memo” just as expected.
Has anyone an idea why my text is inserted into this body field at the wrong position? Thanks in advance.