Sets a new lock or updates an existing lock on the object. Calling this method has no effect in preventing others from updating a locked object (with the exception that others cannot re-lock the locked object). This lock mechanism is used for custom purposes only and has no bearing on the actual ability to update an object.

To successfully execute this method, the current user must have permission to modify this object's properties. For example, locking a Document object requires the following combination of access rights: AccessRight.CHANGE_STATE | AccessRight.CREATE_INSTANCE | AccessRight.LINK | AccessRight.UNLINK | AccessRight.VIEW_CONTENT | AccessRight.WRITE | AccessRight.READ_ACL | AccessLevel.READ.

If the call succeeds:

  • The object's LockOwner property is populated with the user name specified in the owner parameter. (New lock only.)
  • The value specified by timeoutis applied to the object's LockTimeout property.
  • A LockToken (GUID) is internally created by the server. (New lock only.)

To update an existing lock, the objects needs to be in the locked state and the current user needs to match the user of the lock. Note that the user is the logged in user, not the owner string. If the call succeeds, then only the LockTimeout property is updated with the timeout value. The owner parameter in this case is ignored. (See the UpdateLock() method instead.)

Namespace:  FileNet.Api.Core
Assembly:  FileNet.Api (in FileNet.Api.dll)

ToggleSyntax

Visual Basic (Declaration)
Sub LockObject ( _
	timeout As Integer, _
	owner As String _
)
C#
void LockObject(
	int timeout,
	string owner
)
Visual C++
void LockObject(
	int timeout, 
	String^ owner
)
JavaScript
function lockObject(timeout, owner);

Parameters

timeout
Type: System..::.Int32
An integer that represents the number of seconds after which the lock will expire. The range of values is 0 to 2147483647 (Integer.MAX_VALUE) seconds.
owner
Type: System..::.String
A String representing the user name to be assigned as the owner of the lock on this object. Defaults to the short principal name of the requesting user. The value is strictly advisory and is not validated against user or group names known to the Content Engine. The value can be used by client applications to identify the user who has locked the object.

ToggleExceptions

ExceptionCondition
ExceptionCode..::.E_OBJECT_LOCKEDIf the object is already locked and the current user does not match the user of the lock.
ExceptionCode..::.E_OBJECT_NOT_LOCKEDIf the user tries to update an existing lock but the object is not locked (absence of a LockToken).

ToggleSee Also