Basic setup:Notes client
New doc or existing doc
RT Field - ‘AttachFiles’
I want to attach a specific file into the field ‘AttachFiles’ via LotusScript.
Everything I try dumps the file to the bottom of the form in the V2 attachment format.
I’ve searched this forum and the 4/5 forum without much luck. I’m sure something somebody has posted is the tip-off, but I’m just not seeing it.
What I’ve tried:
Dim rtitem as NotesItem
Dim object as NotesEmbeddedObject
Dim doc as NotesDocument
…
Set rtitem = doc.GetFirstItem(“AttachFiles”)
Set object = rtitem.EmbedObject(EMBED_OBJECT, “”,“c:\junk.txt”)
Call doc.save(true,false)
Set rtitem = doc.GetFirstItem(“AttachFiles”)
If (rtitem is nothing) then
Set rtitem = New NotesRichTextItem(doc,“AttachFile”);
Set object = rtitem.EmbedObject(EMBED_OBJECT, “”,“c:\junk.txt”)
End If
Call doc.save(true,false)
Set rtitem = New NotesRichTextItem(doc,“AttachFile”);
Set object = rtitem.EmbedObject(EMBED_OBJECT, “”,“c:\junk.txt”)
Call doc.save(true,false)
I’ve also tried it without using the doc.Save and letting the user save the doc via the UI - still at the bottom.
I have also considered saving the doc before attaching it in the hopes that the attachment field will be ‘add’ the field and magic would happen, but the app is part of a cluster and I’ve had some problems with rep/save docs popping up if you use code to do saves in rapid succession and I don’t want to go there if I don’t need to. If I re-run the current code on an existing doc, the attachments all wind up at the bottom anyway so I’m not sure doing a ‘pre-save-save’ would help anyway.
I guess in the greater scheme of things, having the attachment(s) at the bottom of the form isn’t a huge deal, but it’s gonna confuse folks and I’d prefer to have it in the intended field. (I mean look like it’s in the intended field, that $file with the link in the field thing is understood).
Thanks for any pointers.
Doug