[Answered] Getting attachment data from Querysave/Querysend

Need to access attachments data (ideally file raw bytes, but even the names would be great) from LotusScript before a message is saved or sent.

I cannot use NotesDocument.Items, because all attachments share same field name “$FILE” and I can see only the first instance.

It must be possible, because $FILE items are shown correctly in the LotusScript debugger.

Subject: Never mind, that’s silly…

  • If Items can’t find more than one, how do you get more than one NotesRichtextItem? Sheesh…

Subject: No RichTextItems are available at that time anyways…

I could iterate through all RichText elements of the doc, but the body of backend doc is missing in Querysend/Querysave event.

Body exists in Postsave, with EmbeddedObjects ok, but it is too late.

Subject: Please read about uidoc.Refresh, 1st argument

Subject: Body must be current field

It worked fine, thanks!

One strange thing though: If the focus is outside the message body, you get “Only plain text can be used in this type of field” error.

In Memo (Form):

Sub Querysend(source as NotesUIDocument, Continue as Variant)

source.GotoField(“Body”)

Call source.Refresh(True)

seems to work.

Subject: There’s something else in your code making that happen

Something in the QueryRecalc event for instance.