Sub Click( Source As Button )
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim newsletter As NotesNewsletter
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set newsletter = New NotesNewsletter( collection )
Set doc = newsletter.FormatMsgWithDoclinks( db )
doc.Form = "Summary"
Call doc.Save( True, True )
End Sub
Dim session As New NotesSession
Dim db As NotesDatabase
Dim summaryDb As NotesDatabase
Dim collection As NotesDocumentCollection
Dim newsletter As NotesNewsletter
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set summaryDb = New NotesDatabase _
( "", "summary¥science.nsf" )
Set collection = db.FTSearch( "botany", 0 )
Set newsletter = New NotesNewsletter( collection )
newsletter.DoScore = True
Set doc = newsletter.FormatMsgWithDoclinks( summaryDb )
doc.Subject = "Garden of Botanical documents"
doc.Form = "Summary"
Call doc.Save( True, True )
その後、スクリプトは各文書に処理済みのマークを付けます。このため、UnprocessedFTSearch メソッドはこのエージェントの次回実行時にこれらの文書に対しては検索を行いません。
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
Set originalDoc = collection.GetFirstDocument
Do Until originalDoc Is Nothing
Call session.UpdateProcessedDoc( originalDoc )
Set originalDoc = collection.GetNextDocument(originalDoc)
Loop
Next
End Sub