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 ) 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:
Dig Deeper on LotusScript
Related Q&A from Cregg Hardwick
A user wants to know if it's possible for LotusScript to read an attachment in a Notes document without first detaching it. Find out our expert's ... Continue Reading
Learn about different options using LotusScript code and Formula language to customize the principal field of outgoing Lotus Notes email messages. Continue Reading
Read about merging cells in a Microsoft Word table using LotusScript and an Excel example, along with the thought process that goes along with it. Continue Reading