Examples: LockProvisional method (NotesView - LotusScript®)

This view action attempts to lock the view named "Main View" for all members of the "Guys" group. Locking is successful if the view is not yet locked, or the view is locked but the effective user is a member of Guys. A provisional lock is placed.

%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 view
  Dim view As NotesView
  Set view = db.GetView("Main View")
  
  REM Lock the view
  REM Not locked if return is False or error is raised
  On Error Goto errh
  If view.LockProvisional("Guys") Then
    Print "View locked - " & view.Name
  Else
    Print "View NOT locked - " & view.Name
  End If
  Exit Sub
errh:
  If Err() = lsERR_NOTES_LOCKED Then
    Print "View NOT locked - " & view.Name
  Else
    Messagebox "Error " & Err() & ": " & Error(),, "Error"
  End If
  Exit Sub
End Sub