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 WebDAVCOPY Method creates a duplicate of the source resource identified by the Request-Uniform Resource Identifier (URI), in the destination resource identified by the Destination Header. The COPY Method can be used to duplicate collection and property resources.
A Depth Header value of "0" or "infinity" may be included in a COPY Method. If a COPY Method with a Depth Header value of "infinity" is used, the collection and all of its internal resources will be copied from the URI specified by the request URI, to the URI specified by the Destination Header. If a COPY Method with a Depth Header of "0" is used, only the collection and its properties will be copied. When a COPY Method does not include a Depth Header, the default value is "infinity".
If a resource exists at the destination URI and the Overwrite Header is "T", then a DELETE with a depth value of "infinity" is performed on the destination resource before the COPY Method is performed. If the Overwrite Header is set to "F", then the COPY Method will fail.
|201 (Created)||The resource was successfully copied.|
|204 (No Content)||The source resource was successfully copied to a pre-existing destination resource.|
|403 (Forbidden)||The source URI and the destination URI are the same.|
|409 (Conflict)||A resource cannot be created at the destination URI until one or more intermediate collections are created.|
|412 (Precondition Failed)||Either the Overwrite header is "F" and the state of the destination resource is not null, or the method was used in a Depth: 0 transaction.|
|423 (Locked)||The destination resource is locked.|
|502 (Bad Gateway)||The COPY destination is located on a different server, which refuses to accept the resource.|
|507 (Insufficient Storage)||The destination resource does not have sufficient storage space.|
The following example illustrates a WebDAVCOPY Method with an Overwrite Header value of "T". The operation is completed successfully and a status code of 201 (Created) is returned.
COPY /~username/index.html HTTP/1.1 Host: www.contoso.com Destination: http://www.contoso.com/~username/folder/index.html Overwrite: T
HTTP/1.1 201 Created
The following example illustrates a WebDAVCOPY Method with a lock token in the If Header. The operation is not completed successfully because there is a lock in place on the destination resource.
COPY /public/user/index.html HTTP/1.1 Host: www.contoso.com Destination: http://www.contoso.com/public/backup/index.html If: <http://www.contoso.com/public/backup/index.html> (<opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6>)
HTTP/1.1 423 Locked