Search code examples
lotus-noteslotusscriptlotus

Removing attachments from the bottom of a Notes Document?


I have Notes Documents that have attachments at the bottom of the document(yes I know what causues it). How do I programaticly remove those attachments without removing attachments that are in fields?

I was hoping to use NotesDoument.Embeeded objects but it does not include file attachments. :(


Solution

  • You could use Evaluate() (yes, this is one of the few times you want to use it), calling the @AttachmentNames formula to get a list of all attachment in the document. You can then process the array you get back and compare to the ones you have attached in the rich text fields, and delete the ones you don't want.

    I would first get all embedded attachments from the rich text fields, and store the names in a list. Then I would use @AttachmentNames to get all attachments on the document and put them in another list. Bot lists should have the file name as the list tag. You can now very easily loop through the second list using ForAll, and if there is no matching ´list item in the first list, delete the attachment from the document. Use IsElement() to check is a specific list item exists.