Option Public
Option Declare
'Declarations.
Dim debug As Integer
Dim sdoc As NotesDocument
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim agent As NotesAgent
Dim adminp As NotesAdministrationProcess
Dim agentFound As Integer
Dim nam As NotesName
Dim noteid As String
Set db = session.CurrentDatabase
agentFound = False
'Get the agent.
Forall a In db.Agents
If ( a.Name = "Some Agent Name" ) Then
Set agent = a
agentFound = True
Print "Agent " + agent.Name + " found."
Exit Forall
End If
End Forall
'Enable the agent.
If agentFound Then
agent.IsEnabled = True
Call agent.Save
Print "Agent " +agent.Name + " enabled."
End If
'Issue AdminP request to sign database with server's ID.
Set nam = session.CreateName( db.Server )
Set adminp = session.CreateAdministrationProcess( nam.Abbreviated )
noteid$ = adminp.SignDatabaseWithServerID( nam.Abbreviated, db.FilePath )
Print "Issued AdminP request to sign database with server's ID."
End Sub
If it's tech related...I'll post it here. Lotus Notes/Domino, AS400 or iSeries, PC's, PDA's, iPods, Android -- Whatever.
Wednesday, May 30, 2012
Enable an Agent then Sign It With The Server ID
Do you need to turn an Agent Off or On -- but keep it signed by your server? This script will do the trick. It is especially useful if you are sending email from the agent but don't want it coming from anyone other than your server. Name your agent in the code, add this to a button in your application and you'll be all set!
Labels:
Domino,
Email,
Lotus Script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment