This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Jun 19, 2014, 12:32 AM
31 Posts

Moving File Attachments

  • Category: Application Development
  • Platform: All Platforms
  • Release: 9.0
  • Role: Developer
  • Tags: RTF
  • Replies: 2

I am working with a Notes application with several hundred documents, many were created by Notes client and have file attachments in a RTF called ProjectSummary which contains Rich Text other than attachment. Other documents were created by a web browser and have files attached to the document rather than a field. I want to cycle through the documents and move all the attachments to a RTF called Attachments. Does anyone have a code snippet that could get me started. I'm guessing that I will need to save the files locally then reattach them.

 

Jun 19, 2014, 4:10 PM
24 Posts
Code Sample for moving attachments from 1 rtf to another
You are correct that you have to detach the attachments form the current rtf to disk (OS), then re-embed them into the other rtf.  

*Use GetFirstItem method to get handle to the 2 rtfs.  

*Use the NotesEmbeddedObject ExtractFile method to save the attachment to disk.  
*Then, re-attach using embedobject with the Embed_Attachment "type".  


For example:

Set rtitem=doc.getfirstitem("RTF")

      Forall object In rtitem.embeddedobjects

      If object.type=embed_attachment Then
               Call o.extractfile("C:\temp\" + o.source)

       Call body.embedobject(Embed_Attachment, "", "C:\temp\" + o.source)

       Kill "C:\temp\" + o.source

       Call o.remove

       Save=True

     End If

Call doc.save


This is the best code snippet I know of:

Title:        Using LotusScript to move attachments or objects from one field to another
Doc #:        1109976
URL:        
http://www.ibm.com/support/docview.wss?uid=swg21109976

But watch out when using the "remove" method...:

Title:        LotusScript Remove method removes attachment from Rich Text field but not from document
Doc #:        1166667
URL:        
http://www.ibm.com/support/docview.wss?uid=swg21166667

Other code snippets from an old forum (these methods haven't really changed since then):

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/1ad56e5f4862196485256f5b0081ae1f?OpenDocument&Highlight=0,lotusscript,embed_object,attachment
http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/019fcd2e0164eb19852572610040f336?OpenDocument

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal