RenderToRTItem does not generate new items on target document

I have the following lines of code in an agent that is supposed to send a copy of a document to an internet address:

Set Doc = New NotesDocument( db )

Set rtitem = New NotesRichTextItem( Doc, “Body” )

list of calls to rtitem.AppendText followed by rtitem.AddNewLine(1), all working fine

Doc.Form = “Memo”

Doc.Subject = TransferDoc.Subject

'Call Doc.Save(True, False)

success = TransferDoc.RenderToRTItem( rtitem )

If success Then

Messagebox "Rendered OK"

Else

Messagebox "Render Failed"

End If

For most people this works fine. If I run the code through debugger, at the point where the RenderToRTItem is called there are the 3 items Body, FORM and SUBJECT.

After the call, 2 new items are added, $FILE (there is one inline attachment on the Body of the source doc) and $Fonts, and the text of the original message is appended to the Body item.

For a small number of users the RenderToRTItem does nothing every time, but its return value is still true. If I run the same code with one of these user’s IDs on the same document using my own machine it works fine every time. Whether I comment out the Doc.Save or not makes no difference.

So I’m thinking client config… I’ve checked the forums for suggestions but most relate to MIME. Since this is happening within the same document which works for other people I don’t think the source document format is the problem. And we are losing the original body and attachments before we try to send the message. I fact I have changed the send to a save to just make a copy of the document in the current database, and the original Body information is lost.

Any suggestions gratefully appreciated.

Rob

Subject: RenderToRTItem does not generate new items on target document

You have to save the new document before rendering RT Item which is commented in your code.

Create a document and fill in the fields.

Save it.

Now from the saved document, Set the RTItem

Render RTItem

Again Save the document.

dim rtitem as variant

dim rt as notesRichTextItem

Set Doc = New NotesDocument( db )

Doc.Form = “Memo”

Doc.Subject = TransferDoc.Subject(0)

Set rtitem = New NotesRichTextItem( Doc, “Body” )

…

…

rtitem.AddNewLine(1)

Call Doc.Save(True, False)

set rt = Doc.GetFirstItem(“Your RT Item”)

success = TransferDoc.RenderToRTItem(rt)

Call Doc.Save(True, False)

If success Then

Messagebox “Rendered OK”

Else

Messagebox “Render Failed”

End if

Subject: RE: RenderToRTItem does not generate new items on target document

I have tried with and without the save before calling RenderToRTItem, but it does not make any difference for the users who are having the problem.

I have got a workaround using AppendRTItem method, but it turned out that clearing the data directory and then re-installing the Notes client & running setup fixed the problem.