Hi,
I have written the agent below whic is supposed to call the Calendar profile and change the users signature path from c: to d: - the Agent works fine when signed and scheduled with my ID - however as soon as I use our corporate signer (which has full ECL access) it produces this error:
31/10/2006 10:53:00 AMgr: Agent ‘Fix_profile’ is scheduled to run next at: 31/10/2006 10:57:00
31/10/2006 10:57:00 AMgr: Start executing agent ‘Fix_profile’ in ‘FixNotes.nsf’ by Executive ‘1’
31/10/2006 10:57:00 AMgr: ‘McKinsey Unrestricted Database Signer/…’ is the agent signer of agent ‘Fix_profile’ in ‘FixNotes.nsf’
31/10/2006 10:58:00 AMgr: Agent ‘Fix_profile’ in ‘FixNotes.nsf’ does not have proper execution access, cannot be run
31/10/2006 10:58:00 AMgr: Agent ‘Fix_profile’ is scheduled to run next at: 31/10/2006 11:02:00
31/10/2006 11:03:00 AMgr: Start executing agent ‘Fix_profile’ in ‘FixNotes.nsf’ by Executive ‘1’
31/10/2006 11:03:00 AMgr: ‘McKinsey Unrestricted Database Signer/…’ is the agent signer of agent ‘Fix_profile’ in ‘FixNotes.nsf’
When I use my own ID it works:
31/10/2006 11:50:00 AMgr: Start executing agent ‘Fix_profile’ in ‘FixNotes.nsf’ by Executive ‘1’
31/10/2006 11:50:00 AMgr: ‘Ralph/LON/Europe/…’ is the agent signer of agent ‘Fix_profile’ in ‘FixNotes.nsf’
31/10/2006 11:50:00 AMgr: Agent (‘Fix_profile’ in ‘FixNotes.nsf’) printing: Getting handle to Mail Preferences…
31/10/2006 11:50:00 AMgr: Agent (‘Fix_profile’ in ‘FixNotes.nsf’) printing: Mail signature path changed.
31/10/2006 11:51:00 AMgr: Agent ‘Fix_profile’ in ‘FixNotes.nsf’ ran successfully; elapsed time was ‘1’ ticks
31/10/2006 11:51:00 AMgr: Agent ‘Fix_profile’ is scheduled to run next at: 31/10/2006 11:55:00
Here is the Code:
Sub Initialize
Dim s As New NotesSession
Dim thisdb As NotesDatabase, thisdoc As NotesDocument
Dim maildb As New NotesDatabase("", "")
Dim mailprof As NotesDocument ' Mail Preferences profile
Dim sigpath As Variant
Dim addpath As Variant
Dim searchpath As Variant
Dim eval As Variant
'Get hold of mail DB
Set thisdb = s.CurrentDatabase
Call maildb.OpenMail
If maildb.IsOpen = False Then Error 1000, "Unable to find Mail database - aborting..."
'Get hold of preferences
Print "Getting handle to Mail Preferences..."
Set mailprof = maildb.GetProfileDocument("CalendarProfile")
sigpath = mailprof.GetItemValue("Signature_2")
'If no signature then exit
If sigpath(0) = "" Then Goto getOut
'Create paths
addpath = "D"
searchpath = "C"
'Change path to D:
sigpath = Replace(sigpath, searchpath, addpath)
Call mailprof.ReplaceItemValue("Signature_2", sigpath)
'Save new path
Call mailprof.ComputeWithForm(True, False)
Call mailprof.Save(True, False)
'Output info
Print "Mail signature path changed."
'Get out when done
getOut:
Exit Sub
'Error handling
errHandler:
Select Case Err
Case 1000
Print "Error"
Case 1001
Print "Notes fix aborted!"
Case Else
Thanks for taking a look,
Ralph