The script then marks each document as processed so that the UnprocessedFTSearch method does not search for these documents the next time the agent runs.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim newsletter As NotesNewsletter
Dim doc As NotesDocument
Dim j As Integer
Dim originalDoc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.UnprocessedFTSearch( "botany", 0 )
Set newsletter = New NotesNewsletter( collection )
newsletter.DoScore = True
newsletter.DoSubject = True
newsletter.SubjectItemName = "Topic"
Set doc = newsletter.FormatMsgWithDoclinks( db )
doc.Subject = "New botany documents from this week"
doc.Form = "Memo"
Call doc.Send( False, "Susanna Tallan" )
' mark all documents in newsletter's collection as
' processed, so that they aren't included in the
' newsletter next time
For j = 1 To collection.Count
Set originalDoc = collection.GetNthDocument( j )
Call session.UpdateProcessedDoc( originalDoc )
Next
End Sub