Examples: Owner property

  1. This script gets the name of the person who last modified the current agent. For example, if Yukiko Kitarmura/Tokyo/Production created the agent and then Mariko Ikebuchi/Tokyo/Production modified it, Mariko is considered to be the owner and the CurrentAgent property returns "CN=Mariko Ikebuchi/OU=Tokyo/O=Production."
    ' 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
  2. This agent script goes through the unprocessed documents in the current database and logs an action for each document it processes. The script uses the Owner property to send the log to the owner of the agent.
    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