Obtain a lock for a specified resource.
int LockResource(const QString& qsResourceURI);
The LockResource method will request a new lock to be placed on ResourceURI in the user's name so that only the user can operate on it. The method is linked to a number of properties that it uses to generate the lock request:
|LockOwner||The principle that will own the lock.|
|LockScope||The scope of the lock. The class only currently supports locks of scope "exclusive" and "shared".|
|LockTimeout||The amount of time that the lock is allowed to exist before ResourceURI is automatically unlocked by the server.|
|LockTokens||The lock itself. If the user sets this before making the request, the timeout on the existing lock will be refreshed (reset to 0). Otherwise, a new set of lock tokens will be returned.|
|LockType||The type of lock. The class only currently supports of type "write".|
This method is associated with the Depth property. If Depth is set to "0", the class will lock only ResourceURI and its properties. If Depth is set to "infinity", the class will lock ResourceURI and its entire subtree.
If MoveResource or CopyResource are used to place a resource or collection in a location under a resource locked with "infinity", the new resource or collection will be added to the lock. Any lock on a collection will prevent non-lock owners from adding resources to that collection.
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)