Moving attachments

Hi evrybody!!!

I have an issue regarding the movement of a attachment file from one RTfield to another RTfield on the same form,also deleting the attachment from the first RTfield.The RTfield where the attachment should be moved needs to store as many attachments as possible.

I tryed to move the attachment from first RTfield to disk and then from disk to move it to 2 nd RTfield. Everything was ok only that , after the file was moved the file type icon disappeared and at the bottom of the form a second name of the attachment file was displayed…something like “ATT” and another 3 random letters and/or numbers.Another issue at this piece of code was that when i tryed to save another attachment to same RTfield the first attach’ stored in that field was replaced by the newest one.

Can someone please offer me some assistance or some hints regarding how to solve this issue?

Thank you in advance!

Subject: Moving attachments

well you can start by posting your code so we can see what you have done so far.

Subject: RE: Moving attachments

Sub MoveAttachment(doc As NotesDocument,rt1 As NotesRichTextItem, rt2 As NotesRichTextItem)

Dim object As NotesEmbeddedObject

Forall o In rt1.embeddedobjects

Save=False

If o.type = Embed_ATTACHMENT Then

Call o.extractfile("C:\temp" +o.Name)

Call rt2.embedobjec(Embed_Attachment, “”, "C:\temp" +o.Name)

Kill "C:\temp"+o.Name

Call o.remove

Call doc.Save(False,True)

End If

End Forall

Save=True

If Save Then Call doc.Save(False,True)

End Sub

This is the code that i am using .I found and fixed some mistakes that i was doing , but still i have issues with the icons of the files that where moved and sometimes with the “ATT” filename format.

Subject: Moving attachments

'Get the handle of richtext field wher you want to copy the here Comments is field

Dim rtitem As NotesRichTextItem

Dim ritem As NotesRichTextItem

'set this thisdoc

Set rtitem = thisdoc.GetFirstItem(“Comments”)

'get the handle of othet rich text field where you are actually attaching here is Attachment

Set ritem=thisdoc.GetFirstItem(“Attachment”)

Call rtitem.AppendText(“Attachment :”)

Call rtitem.AppendRTItem(ritem)

'once you append the rich text replace it by NULL

call thisdoc.replaceitemvalue(“Attachment”,“”)

then save it

it’ll work

Subject: RE: Moving attachments

Thanks for your help!

I tryed your code and unfortunatley it doesent work .

call rtitem.AppendRTItem(ritem) returns and error:

“missing rich text object”

Subject: RE: Moving attachments

the error is likely occurring because the rich text object is blank or null. I don’t think you can use append with a null object. I’ve seen something similar when using AppendToTextList, when the list was empty it would throw an error.

Subject: RE: Moving attachments

I managed to fix the error and now i look for a solution to keep in the second rtfield only the attach without text …

I found something helpful in a post on this forum, a piece of code that uses RichTextNavigator …but it’s not working for me at this moment .

If someone has any idea about a pice of code that removes everything from a rtfield without removing the attachment ,i would realy appreciate his help like i appreciate the hints that all of you gaved to me .

Thanks !!!