Multi doclinks in agents

Hi Everyone,

I am trying to create an email to send out to people that contains multiple doclinks from Lotus Script. Is this possible from an agent, because the only code I have to do this is to do it and on selected documents in a view manually.

Would an agent simply run on every document and create a seperate email and doclink for every document it finds as a match. Could I get it to put all of the doclinks into the same email?

The idea behind this is that each night an agent would run and check which documents would need checking, if would then send a single email to a user with all of the doclinks inside the single email. Instead of sending out multiple emails to the same user.

This is the code I have so far, execuse the bad programming still learning script. This works on one document from a form, could I modify it to send multple doclinks from an agent.

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document



Dim notification1  As String

notification1 = uidoc.fieldgettext("Notification")

Msgbox notification1



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" )

Call rtitem.Addtab(1)

Call rtitem.AppendText("Hi Their!")



newDoc.form = "Memo"

newDoc.Subject = "Here is a link to the document"

newDoc.SendTo = notification1

newDoc.Send( True )

Thanks

Matt

Subject: multi doclinks in agents

You can extend your existing code to iterate over a collection of documents, with the AppendDocLink call (and text or anything else you want) inside the loop.Alternatively you can get your doc collection and use the NotesNewsletter class to build the e-mail with doclinks for you, using the FormatWithDoclinks method.