Domino Code Fragment

Code Name*
How to use LotusScript to Mail a Memo with a Doclink to the Original Document.
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.12.107.29
Description*
How to use LotusScript to Mail a Memo with a Doclink to the Original Document.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

Problem:
Is it possible, via LotusScript, to mail a memo with a doclink to the original document

that the memo was mailed from?

Solution:
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.

     Sample Script:

     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