Examples: UnLock method

This view action attempts to unlock the agent named "Main Agent." Unlocking is successful if the effective user is one of the lock holders.

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 Unlock agent
  REM Agent is not unlocked if error is raised
  On Error Goto errh
  Call agent.UnLock
  Print "Agent unlocked - " & agent.Name
  Exit Sub
  Print "Agent NOT unlocked - " & agent.Name
  Exit Sub
End Sub