Q

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?

VIEW MEMBER FEEDBACK TO THIS ASK THE EXPERT Q&A. 

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.

MEMBER FEEDBACK TO THIS ASK THE EXPERT Q&A:

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:

This was first published in April 2007

Dig deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • 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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close