例: UnLock method (NotesDocument - LotusScript®)

次のビューアクションは現在の文書のロックを解除しようとします。有効なユーザーがロック所有者の 1 人である場合、ロック解除は成功します。

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.IsDocumentLockingEnabled Then
    Print "Document locking not enabled"
    Exit Sub
  End If
  
  REM Get selected document
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  
  REM Unlock document
  REM Document is not unlocked if error is raised
  On Error Goto errh
  Call doc.UnLock
  Print "Document unlocked"
  Exit Sub
errh:
  Print "Document NOT unlocked"
  Exit Sub
End Sub