Before I upgrade to R6x, I’d like to change the agent restrictions settings from “1. Do not allow restricted operations” to “2. Allow restricted operations” in order to get rid of that error “Operation is disallowed in this session”
Can you do this programmatically?
Subject: ANSWER:Set Agent Restrictions & Sign Agent via LS or API?
Sub Initialize
' Notes/Domino 6 only
%REM
RE: Agent for checking Runtime Security Level
Posted by Rod Whiteley on 4.Sep.03 at 06:23 AM using Lotus Notes
Category: Domino Designer – AgentsRelease: Release 5Platform: All Platforms
You can use code like the sample below to find agents in a database and check the runtime security level:
%END REM
’ Exit Sub
Dim session As New NotesSession
Dim db As New NotesDatabase("QANotes/Madoff","systems\emergency.nsf")
Dim agents As NotesNoteCollection
Set agents = db.CreateNoteCollection(False)
With agents
.SelectAgents = True
.BuildCollection
End With
Dim agent As NotesDocument
id$ = agents.GetFirstNoteID
While Not id$ = ""
' With db.GetDocumentByID(id$)
Set agent=db.GetDocumentByID(id$)
With agent
If .HasItem("$Restricted") Then
Select Case .~$Restricted(0)
Case 0 : r$ = "Allow restricted operations"
Case 1 :
r$ = "Do not allow restricted operations"
Call agent.ReplaceItemValue("$Restricted",0)
Call agent.Save(True,False)
Case 2 : r$ = "Full administration rights"
Case Else : r$ = "Unknown setting"
End Select
Else
r$ = "Not set"
End If
Messagebox .~$TITLE(0) & Chr$(10) & r$
End With
id$ = agents.GetNextNoteID(id$)
Wend
'To change the setting, change the value of the $Restricted item, then sign the agent note and save it.
'This sample code is only for Notes 6, but you can run it in a Notes 6 client against a database on an R5 server.
'It is not clear to me why you need the code to run on a server. ’
End Sub
Subject: RE: ANSWER:Set Agent Restrictions & Sign Agent via LS or API?
Make sure you do this with the proper id. Manipulating the values as done in this example does not do anything if the signing id does not have the proper rights.
Explanation can be found here
http://www-10.lotus.com/ldd/today.nsf/62f62847467a8f78052568a80055b380/177bbe55c6848ae000256c44003aee17?OpenDocument&Highlight=0,kadashevich