Partager via


UNLOCK Method

UNLOCK Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release. The WebDAVUNLOCK Method is used to remove the lock on the resource at the request Uniform Resource Identifier (URI). The UNLOCK Method may also be used to end a transaction that was initiated by the LOCK Method.

Removing a Lock

The lock token in the Lock-Token Header identifies the lock that is to be removed. The lock will be removed from the resource at the request URI and from all other resources included in the lock. If every resource that is locked under the submitted lock token cannot be unlocked, then the LOCK Method will fail.

Ending a Transaction

Ending a transaction is similar to removing a lock, except that the lock token submitted in the Lock-Token Header identifies a transaction. In the UNLOCK Method request XML body the client must also specify whether the transaction is to be committed or aborted. To commit the transaction, the commit XML Element must be included within the transactionstatus XML Element of the request body. To abort the transaction, the abort XML Element must be included within the transactionstatus XML Element of the request body.

Note  See Authentication and Security Using WebDAV for more information.

The list of WebDAV Protocol Status Codes in the following table is not comprehensive. For information about 500-level status codes, see WebDAV Status Codes: 500s.

Status Codes

Status Code Meaning
204 (No Content) The command succeeded. Used instead of a 200 (OK) because there is no response entity body.
400 (Bad Request) The lock token submitted corresponds to a transaction and a request XML body was not submitted.
424 (Method Failure) One of the methods in the transaction failed, therefore the entire transaction failed.

Example

The following example uses the WebDAVUNLOCK Method to successfully remove the lock identified by the lock token "opaquelocktoken:e71d4fae-5dec-22df-fea5-00a0c93bd5eb1".

Request

UNLOCK /docs/myfile.doc HTTP/1.1
Host: www.contoso.com
Lock-Token: <opaquelocktoken:e71d4fae-5dec-22df-fea5-00a0c93bd5eb1>
Authorization: Digest username="user",
   realm="user@contoso.com", nonce="...",
   uri="/docs/myfile.doc",
   response="...", opaque="..."

Response

HTTP/1.1 204 No Content

Example

The following example uses the WebDAVUNLOCK Method to successfully commit the transaction identified by the lock token "opaquelocktoken:a31d4fce-5dec-17df-2da5-00c0c63bd4eb1".

Request

UNLOCK /public/myfile.doc HTTP/1.1
Host: www.contoso.com
Lock-Token: <opaquelocktoken:a31d4fce-5dec-17df-2da5-00c0c63bd4eb1>
Content-Type: text/xml

<?xml version="1.0" ?>
<D:transactioninfo xmlns:D="DAV:">
   <D:transactionstatus><D:commit/></D:transactionstatus>
</D:transactioninfo>

Response

HTTP/1.1 204 No Content

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

This topic last updated: December 2002

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.