I show an error message in the console log related to an agent which HTTP task produced. However, it did not tell the which database this web agent located in? Therefore, I need to find this agent name in all the databases. Is there any functionality or command to list all the agents in the server? “show agents” command shows only the agents in a database?
Dim session As New NotesSession
Dim theagent As NotesAgent
Dim i As Integer
Dim Cdb As NotesDatabase
Dim agentString As String
Dim server1 As String
Dim server As New notesname(session.CurrentDatabase.Server)
Dim DbName As String
server1 = server.Common
Dim dbdir As New NotesDbDirectory(server1)
Dim db As NotesDatabase
Set db = dbdir.GetFirstDatabase(DATABASE)
agentString = agentString & Chr(10) & db.FileName
While Not(db Is Nothing)
DbName = db.FileName
Set Cdb = New NotesDatabase(server1, DbName)
On Error Goto nextDB
Forall agent In Cdb.Agents
agentString = agentString & " -- " & agent.Name
End Forall
Set db = dbdir.GetNextDatabase
agentString = agentString & Chr(10)
agentString = agentString & Chr(10) & db.FileName
Wend
Dim ansv As Variant
Dim ws As New NotesUIWorkspace
ansv = ws.Prompt(PROMPT_YESNOCANCEL, "Report finished", "Do you want this report as a mail to yourself?")
If ansv = 1 Then
Dim doc As NotesDocument
Dim rtitem As Variant
Set db = session.CurrentDatabase
Set doc = db.CreateDocument
doc.Form = "Memo"
doc.Subject = "Agent Report"
Set rtitem = doc.CreateRichTextItem( "Body" )
Call rtitem.AppendText(agentString )
Call doc.Send( False, session.UserName)
Exit Sub
Else
Messagebox agentString,, "Agents"
Exit Sub
End If
nextDB:
agentString = agentString & " Error occured - probably no agents in this database "
Resume Next