Rich text is missing $File - Lotus Script AppendRtItem - method fails

Trouble: In the view there is one document with an attachment (seems to be in then body field (not linked on the document))Open the document a open the attachment, its run fine.

In a view select the document, and use the action “Response”.

An agent will start (see downwards).

In the agent we’ll create a new document, setting up an body- rich text-field.

In line 39 (marked red) , we append the rich text field from selected note to the new one.

At least open the document for editing.

Now the attachment $File is missing. When opening the file, error will come up “File is missing”

Any idea, why? Any idea for solution?

Code:

Sub Initialize

On Error Goto ErrorHandling

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim note As NotesDocument 'das neue Dok

Dim selectedNote As NotesDocument  'das in der Ansicht ausgewählte Dokument

Dim rtitem As NotesRichTextItem

Dim nrtitem As NotesRichTextItem

Dim em As String



Set db = session.CurrentDatabase

Set collection = db.UnprocessedDocuments



If collection.Count <> 1 Then Error 15010, "Wählen Sie eine Adresse, eine Adress-Referenz oder einen Ansprechpartner aus!"

Set selectedNote = collection.GetFirstDocument



Set note = db.CreateDocument

note.form = "frm_memo"

Set nrtitem = note.CreateRichTextitem("body")

Call nrtitem.AddNewLine(4, True)

note.subject = "Antwort: " + selectednote.subject(0)

note.SendTo = selectednote.from 

note.CopyTo = Evaluate(" @trim(@unique(copyTo:sendto)) ", selectednote)

note.BlindCopyTo = selectednote.BlindCopyTo

Set rtitem = selectednote.GetFirstItem("body")

Call nrtitem.AddNewLine(1, True)

Call nrtitem.AppendText("______________________________________________")

Call nrtitem.AddNewLine(2, True)

Call nrtitem.AppendRTItem(rtitem)



Call note.ComputeWithForm(True, False)

Call note.MakeResponse( selectedNote )

Call ws.EditDocument( True, note )



Exit Sub

ErrorHandling:

em = Error$

Messagebox em, 16, "Fehler"

Exit Sub

End Sub

Subject: Try:

Call nrtitem.Update	Call note.ComputeWithForm(True, False)

Call note.MakeResponse( selectedNote )

Call ws.EditDocument( True, note )

Subject: Try: Sorry, it doesn’t help… mhmm searching again…