LOTUSSCRIPT/COM/OLE CLASSES


Examples: Lock method
This view action attempts to lock the agent named "Main Agent" for all members of the "Guys" group. Locking is successful if the agent is not yet locked, or the agent is locked but the effective user is a member of Guys. A provisional lock is allowed if the administration server is not available.

%INCLUDE "lsxbeerr.lss"

Sub Click(Source As Button)
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Set db = session.CurrentDatabase
 
 REM Exit if locking is not enabled
 If Not db.IsDesignLockingEnabled Then
   Print "Design locking not enabled"
   Exit Sub
 End If
 
 REM Get agent
 Dim agent As NotesAgent
 Set agent = db.GetAgent("Main Agent")
 
 REM Lock the agent
 REM Not locked if return is False or error is raised
 On Error Goto errh
 If agent.Lock("Guys", True) Then
   Print "Agent locked - " & agent.Name
 Else
   Print "Agent NOT locked - " & agent.Name
 End If
 Exit Sub
errh:
 If Err() = lsERR_NOTES_LOCKED Then
   Print "Agent NOT locked - " & agent.Name
 Else
   Messagebox "Error " & Err() & ": " & Error(),, "Error"
 End If
 Exit Sub
End Sub

See Also