I have scenario where I need prepend some rich text to existing richtext
item . The Rich text Item already have rich text including the
attachements. I also dont want to tamper the formatting of contents in
that rich text item . So to achieve that we are contents in temporary
Rich text Item item1, and then reset the contents in original rt item ,
then append temporary Rich text Item contents to original.
Following is the code used
Dim docTemp As New NotesDocument(CurrentDatabase )
'store the content of Body in a rt field because of some trouble we had with the bodies containing attachments
Set itemRTTemp = Me.Body.CopyItemToDocument( docTemp,"TempRT" )
Call Me.Document.ReplaceItemValue( .Name, "" )
' prepend new rich text contents
Call Me.Body.AppendRTItem( itemRTTemp )
The code is working fine for 90% of documents on which this code is running. But for certain documents with attachments (huge or without icons or file extensions), the following error occurs.
Note item not found TempRT . When debugged the exception occurring at line number 3. above marked in bold ie when CopyItemToDocument is called.
Provided the above scenario can any body help me out to give best possible solution , which holds good for many different notes clients?
Note : I also dont want to detach and re attache attachments .
If there is no other way other than detach and attach attachments to rich text item then i will have relook over provide this work around.