Hi
I need to copy an attachment from 1 document to another document. Both documents has 1 richtextfield for the attachment. Both document have different forms. On document A that field is called Body and on the other it is called attachment.
I use this lotusscripcode to copy the attachments:
Dim item as notesitem
Set item = DocumentA.GetFirstItem(“Body”)
Call item.CopyItemToDocument(DocumentB, “attachment”)
This goes fine as long the attachment on DocumentA is in the field “Body”. So now and then it happens that the attachment is on DocumentA but not in richtext field “Body”. The DOcumentA then does have an attachment by somehow it is not found in the “Body” field. On that document I caqn find the $FILE item, so the attachment is really there.
My question is: How can I still copy the atachment in this situation using Lotusscript?
Regards
Subject: Copy an attachment from document to another document using Lotusscript
You have to use the NotesembeddedObject class to detach the file to a local temporary drive and then re-attach it
Subject: RE: Copy an attachment from document to another document using Lotusscript
Hi
Thank you for the response.
Can you tell me how I can remove an attachemnt from a document which is not really in a richtextfield?
Regards
Subject: RE: Copy an attachment from document to another document using Lotusscript
I just did!
Use the NotesEmbeddedObject class!! Yuo can get this from NotesDocument as well as from NotesRichText. By accessing the NotesDocument EmbeddedObject array this gives you all the attachments on the document, regardless of whether they are in rich text or not. I think there is a reasonable example in Designer help on this.
Subject: RE: Copy an attachment from document to another document using Lotusscript
Hi
You are right. Thank you for the tip.
Regards