Another remove attachment question

I’m using doc.CopyAllItems(doc2). My problem is that I’m trying to remove the attchment(s) in doc2 as well. My code still leaves the icon in doc2 and when clicking on it, I get

“Notes Item Not Found”

I’ve read posts about NotesRichText.GetembeddedObject but I’m sorta confused on this.

Any suggestions on how to remove attachments (as well as icon). Thanks!


Dim rtitem As Variant

Set rtitem = doc2.GetFirstItem( "attachfield" )

If ( rtitem.Type = RICHTEXT ) Then

	If Isarray(rtitem.embeddedobjects) Then

		Forall o In rtitem.embeddedobjects

			Call o.Remove 

		End Forall

	End If

End If

Call doc2.Save(True, True)

Subject: another remove attachment question…

Rich text fields do not update when the ui document is refreshed. You need to add code after your docs.Save(True, True) to close the uidoc and reopen it.

’ Your existing code above

’ -----------------------------

Dim ws as new NotesUIWorkspace

dim em as Boolean

em = ws.CurrentDocument.EditMode

ws.CurrentDocument.Close

ws.EditDocument em, doc2

Subject: RE: another remove attachment question…

Dave,

Hey thanks for the reply. I tried your code but the icon still shows when I open doc2.

Actually, after save, this is what I have in my code and when I open it, the icon is still there. Any suggestions…

Call doc2.Save(True, True)

Call uidoc.Save

Call uidoc.Close(True)

Call workspace.ViewRefresh