Examples: IsEnabled property (NotesAgent - LotusScript®)
This agent toggles IsEnabled for the "Sort incoming mail" agent.
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