I have researched this issue and was unable to come to any definitive conclusions. Attachments are not actually stored in the document, but in a separate object within the Lotus Notes database.
My guess is that the copy operation is either causing corruption of the pointers to these objects, or is failing because the pointers are already corrupt.
The AppendRTItem approach can work, but has a 32K size limit. In my research, I was unable to find anyone who had a solid solution to this problem, but I would suggest detaching the files from the rich-text field, and then attaching them to a new rich-text field in the other document. You might use something like:
Set rtitem=doc.getfirstitem("rtfield") If Not Isempty(rtitem.embeddedObjects) Then Forall o In rtitem.EmbeddedObjects If ( o.Type = EMBED_ATTACHMENT ) Then Call o.ExtractFile ( "DesiredFilePath") End if End Forall End If
If this still doesn't work, you might want to see what the Midas Rich Text LSX toolbox (www.geniisoft.com) can contribute.
I've had the same problem in the past and my workaround was to use the CopyAllItems method, then delete the items you don't need. If this causes a problem with existing items on a destination document, you can then copy all items to a temporary document, delete unwanted items, then copy all items to a Lotus Notes destination document and just the rich-text format (RTF) field will be copied. Finally, you might want to check that the Form name of the destination document survives intact. It works every time for me!
Do you have comments on this Ask the Expert Q&A? Let us know.
Related information from SearchDomino.com:
This was first published in April 2007