COPY Method

COPY 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 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.

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
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.

Example

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.

Request

COPY /~username/index.html HTTP/1.1
Host: www.contoso.com
Destination:  https://www.contoso.com/~username/folder/index.html
Overwrite: T

Response

HTTP/1.1 201 Created

Example

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.

Request

COPY /public/user/index.html HTTP/1.1
Host: www.contoso.com
Destination: https://www.contoso.com/public/backup/index.html
If: <https://www.contoso.com/public/backup/index.html> (<opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6>)

Response

HTTP/1.1 423 Locked

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.