例: IsEnabled property (NotesAgent - LotusScript®)

次のエージェントは、IsEnabled を「Sort incoming mail」エージェントに切り替えます。

Sub Initialize
  Const enabledYes = "Agent is enabled"
  Const enabledNo = "Agent is disabled"
  Const agentName = "Sort incoming mail"
  Const agentNo = "Agent not found"
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Forall agent In db.Agents
    If agent.Name = agentName Then
      If agent.IsEnabled Then
        agent.IsEnabled = False
        Messagebox enabledNo,, agentName
      Else
        agent.IsEnabled = True
        Messagebox enabledYes,, agentName
      End If
      Call agent.Save
      Exit Sub
    End If
  End Forall
  Messagebox agentNo,, agentName
End Sub