Problem solve Get help with specific problems with your technologies, process and projects.

Copying a rich-text field with attachments to a Lotus Notes document

SearchDomino.com's LotusScript expert Cregg Hardwick offers troubleshooting advice to a LotusScript developer trying to copy a rich-text field with several attachments to another Lotus Notes document using the "CopyItemToDocument" and "AppendRTItem" methods.

I am trying to copy a rich-text field that contains more than one attachment to another Lotus Notes document. I've used the "CopyItemToDocument" method, but I got the error message: "Error: Attachment found on more than one document." I also tried the "AppendRTItem" method, but it still throws out the same error. Could you please help me resolve this issue?


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 ) 
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!

—Clive A.

Do you have comments on this Ask the Expert Q&A? Let us know.

Related information from SearchDomino.com:

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...