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
For example, if the agent is called "Brandon's Agent," is owned by Brandon Herkle, and processes three documents, Brandon receives a mail memo with the subject "Log for Brandon's Agent" that has the following Body:
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