Monday, September 26, 2011

Mail a Memo with a Doclink to the Original Document


Is it possible, via LotusScript, to mail a memo with a doclink to the original document that the memo was mailed from?


Below is a sample script* that, when executed (in this case, via a button's click event), generates a mail memo to a particular recipient with an attached doclink that points back to the original document. Note: In order for this script to run properly, the original document must be saved before the script is executed.

 *This is a sample script only. It has not been put through rigorous QE testing. It       is provided to illustrate one approach to providing particular functionality to an       application. While some customers may integrate this code into an application, Lotus in no way officially supports it.

     Sub Click(Source As Button)
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.Document
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim newDoc As NotesDocument
     Dim rtitem As NotesRichTextItem
     Set db = session.CurrentDatabase
     Set newDoc = New NotesDocument( db )
     Set rtitem = New NotesRichTextItem(newDoc, "Body" )
     Call rtitem.AppendDocLink(doc, "TEST" )
     newDoc.Subject = "Here is a link to the document"
     newDoc.SendTo = "Sue Wilson"
     newDoc.Send( True )
     End Sub

No comments:

Post a Comment