' created by Yukiko Kitamura 11/28/95
' modified by Mariko Ikebuchi 12/17/95
Dim session As New NotesSession
Dim agent As NotesAgent
Dim owner As String
Set agent = session.CurrentAgent
owner = agent.Owner
Sub Initialize
Dim session As New NotesSession
Dim agent As NotesAgent
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim currentLog As NotesLog
Dim doc As NotesDocument
Set agent = session.CurrentAgent
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set currentLog = New NotesLog( "Log for " & agent.Name )
Call currentLog.OpenMailLog _
( agent.Owner, currentLog.ProgramName )
For j = 1 To collection.Count
Set doc = collection.GetFirstDocument()
'...do whatever to the document...
Call session.UpdateProcessedDoc( doc )
Call currentLog.LogAction _
( "Processed " & doc.Subject( 0 ) )
Next
Call currentLog.Close
End Sub
例えば、Brandon Herkle が所有する「Brandon's Agent」というエージェントが 3 つの文書を処理するとき、Brandon は「Log for Brandon's Agent」というタイトルのメールメモを受け取ります。メールメモの [本文] フィールドの内容を次に示します。
08/10/95 04:35:02 PM Log for Brandon's Agent starting
08/10/95 04:35:02 PM Processed Status Report for Anthony Pycha
08/10/95 04:35:02 PM Processed Status Report for David Dinauer
08/10/95 04:35:02 PM Processed Status Report for Mary Jo Mastro