My problem is that when I use the Remove method of NotesEmbeddedObject, it removes the attachment from the document, but not the associated icon in the message being edited. Also, when I add an attachment using the EmbedObject method of NotesRichTextItem, I don’t see any icon added. I am told these are two sides of the same problem.
What’s the workaround?
Subject: Are you doing this with backend or frontend classes?
Subject: Lotusscript and attachments
I am using the NotesDocument class. I access it through NotesUIWorkspace.currentDocument. Is that the back-end way? If so, what is the front-end way?
Subject: UIWorkspace and Uidocument is frontend (UI = User Interface = Front end)
(Backend would be e.g. Session.getcurrendatabase, going on with a search or a view or a documentcollection or get documentbyunid.
For your Problem: Refreshing a rich text fields context via script (other fields can’t contain attached files) while the document is open was traditionally impossible, got somewhat better version by version. I am not exactly sure where this is right now but I would not be surprised if you would find at the end of your code, simply closing and opening the document would be enough to have everything look fine.
In general, if you want to avoid issues here, I would do it when the document is closed (Backend classes). To get a sequence of code together to do this is usually tricky, but tends to work reliable, once you are thru.
Subject: Lotusscript and attachments
Thanks for the clarification. The thing is, the icon for the removed attachment remains even after the document is sent. Shouldn’t that have the same effect as a close and reopen? The attached document at least shows up (though with a generic attachment icon, not an application icon), but the icon for the removed attachment is still there. Double-clicking it give the “Notes item not found” error, but this really gets in the way of demo-ing things to management.
Subject: Not sure if it should, But I sure would like it to behave nicely.
If you can break down your sample to something small, it might be well worth to forward to support.