Write a LotusScript agent to automate file attachments

Learn how to create a private, automated LotusScript agent to automate both file attachment and detachment.

I am experienced in VB6 (Visual Basic) and VBA (Visual Basic for Applications) programming. I'd like to use LotusScript to create private agents in my Lotus Notes client 6.5 to automate email file attachment and detachment processes. How can I do this?

Nothing could be easier. But first, you must be aware that the object model doesn't match the user interface (UI):

' where  doc is NotesDocument the document 
you are attaching a document to
Dim object As NotesEmbeddedObject
Dim body as NotesRichTextItem
Set body = doc.GetFirstItem("body") 
' Assume body field is garanteed to exist and 
be rich text.
' OR, IF CREATING A NEW DOC: Set rtitem = 
New NotesRichTextItem( doc, "Body" )
Set object = rtitem.EmbedObject
( EMBED_ATTACHMENT, "", yourFileName)

Do you have comments on this Ask the Expert Q&A? Let us know.

Related information from SearchDomino.com:

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...