Home > Ask the Domino Experts > LotusScript Questions & Answers > Copying a rich-text field with attachments to a Lotus Notes document
Ask The Domino Expert: Questions & Answers
EMAIL THIS

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

Cregg Hardwick EXPERT RESPONSE FROM: Cregg Hardwick

Pose a Question
Other Domino Categories
Meet all Domino Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 26 April 2007
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?

>
EXPERT RESPONSE

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:

  • Tip: Copy attachments in LotusScript without detaching
  • Tutorial: 30 LotusScript tips
  • FAQ: LotusScript advice
  • Reference Center: LotusScript tips and resources


  • Sound Off! -   Be the first to post a message to Sound Off!


    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


    RELATED CONTENT
    LotusScript
    Launch large attachments within an email from a Notes database
    How to find files on a hard drive or mapped network with LotusScript
    Update the ACL from the Roles view with LotusScript
    LotusScript agent moves tagged spam email to junk mail folder
    Set a value in a field existing in another Lotus Notes database
    Create an automatic scheduled view export in Excel
    Top 10 LotusScript tips
    Create a personalized greeting for Lotus Notes database users
    Fail-safe rich-text validation using LotusScript
    How to export Lotus Notes views to a Microsoft Excel database

    LotusScript
    Modifying LotusScript code for date and time handling
    Use DXL utilities for advanced replication settings in Notes
    Use LotusScript to create encrypted replicas
    Write a LotusScript agent to automate file attachments
    Troubleshooting a scheduled agent not running on a Global Notes Architecture (GNA) server
    Setting up local replication of a Lotus Notes database for offline employees
    Creating a link on an HTML page to a Microsoft Word attachment in a Lotus Notes database
    LotusScript to extract and move attachments to a Lotus Notes mailbox or file folder
    How to convert Lotus Notes documents to .PDF files
    Can I stop Lotus Domino Server from transforming embedded images into attachments?

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary



    Search and Browse the Expert Answer Center
    Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
    Browse our Expert Advice

    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




    All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts