Examples: GetAgent method

This example displays all the agents in the current database, and then runs a user-specified agent.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim theAgent As NotesAgent
Dim agentString As String
Set db = session.CurrentDatabase
Forall agent In db.Agents
     agentString = agentString & Chr(10) & agent.Name
End Forall
Messagebox agentString,, "Agents"
Set theAgent = db.GetAgent(Inputbox( _
"Which agent do you want to run?"))
If Not(theAgent Is Nothing) Then
     Call theAgent.Run
Else
     Messagebox "No existing agent selected"
End If