Locking documents and design elements (LotusScript®)

Locks permit you to synchronize multi-user access to documents and the following design elements: agents, forms, and views.

To permit locking in a database:

The following properties and methods manipulate locks:

NotesDocument

NotesAgent

NotesForm

NotesView

LockHolders

LockHolders

LockHolders

LockHolders

Lock

Lock

Lock

Lock

LockProvisional

LockProvisional

LockProvisional

LockProvisional

UnLock

UnLock

UnLock

UnLock

To apply a lock, call Lock or LockProvisional. The first parameter specifies the lock holder or holders, and defaults to the effective user. The LockHolders property returns the current lock holders.

A lock is:

  • Persistent if the administration server is available and Lock is called. If the administration server is not available and provisional locks are not permitted (second parameter to Lock is False), an error is raised.
  • Provisional if the administration server is not available, Lock is called, and the second parameter is True; or LockProvisional is called.

To serialize or otherwise limit access to a document or design element, apply Lock or LockProvisional and examine the return status:

  • True means either:
    • No lock is in effect and your lock is applied.
    • A lock is in effect but the effective user is one of the lock holders. The lock stays in effect.
  • False means a lock is in effect and the effective user is not one of the lock holders.

The typical protocol is to proceed on True, and to exit or wait on False.

Locks are not supported in Web applications.