Examples: Agents property

  1. This action script prints the name of each agent in the current database. Since the script runs on a workstation, it prints the name of shared agents, as well as the names of the current user's private agents, if any.
    Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Set db = session.CurrentDatabase
      If IsArray(db.Agents) Then
        Forall a In db.Agents
          Messagebox( a.Name )
        End Forall
      End If
    End Sub
  2. This script finds the agent in the current database named Periodic Archive and assigns it to the agent object.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim agent As NotesAgent
    Set db = session.CurrentDatabase
    If Not IsEmpty(db.Agents) Then
      Forall a In db.Agents
        If ( a.Name = "Periodic Archive" ) Then
          Set agent = a
        End If
      End Forall
    End Forall