BCOPY Method
Topic Last Modified: 2006-06-13
The WebDAV BCOPY Method is similar to the COPY Method but it is used to copy one or more target resources to a destination.
Unlike the COPY Method, the BCOPY Method contains a request body, which must contain at least one target XML Element, and may optionally contain the propertybehavior XML Element.
A BCOPY Method request includes a Destination Header that specifies the Uniform Resource Identifier (URI) of a collection. By default, each target is copied into the collection specified by the Destination Header. Alternatively, the request may explicitly specify a destination for a specific target. To specify a destination for a given target, the target XML Element must contain exactly one href XML Element; and one dest XML Element.
The responses for the BCOPY Method are similar to those of the COPY Method, but each response node may contain a location XML Element to specify the location of each resource after the operation. Successful responses that did not require the server to change the name of the resulting resource can be omitted from the response.
The BCOPY Method is not supported in transactions.
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. |
207 (Multi-Status) |
Multiple response codes to be found in XML body. |
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) |
The Overwrite header is "F" and the state of the destination resource is not null. |
423 (Locked) |
The destination resource is locked. |
424 (Method Failure) |
The method cannot be supported in a transaction. |
502 (Bad Gateway) |
The BCOPY 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 WebDAV BCOPY Method. Because the request was successful, and the resulting file locations are consistent with those in the request, the response is not a 207 (Multi-Status).
The following example illustrates a BCOPY Method that includes the explicit renaming of resources. File1 is renamed as File1.bak and File2 is renamed as File2.bak.
Request
BCOPY /container/ HTTP/1.1
Host: www.contoso.com
Destination: https://www.contoso.com/othercontainer/
Content-type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:copy xmlns:D="DAV:">
<D:target>
<D:href>file1</D:href>
<D:href>file2</D:href>
</D:target>
</D:copy>
Response
HTTP/1.1 201 Created
Request
BCOPY /container/ HTTP/1.1
Host: www.contoso.com
Destination: https://www.contoso.com/othercontainer/
Content-type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:copy xmlns:D="DAV:">
<D:target>
<D:href>file1</D:href>
<D:dest>file.bak</D:dest>
</D:target>
<D:target>
<D:href>file2</D:href>
<D:dest>file2.bak</D:dest>
</D:target>
</D:copy>
Response
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>https://www.contoso.com/container/file1</D:href>
<D:location>https://www.contoso.com/othercontainer/file1.bak</D:location>
<D:status>HTTP/1.1 201 Created</D:status>
</D:response>
<D:response>
<D:href>https://www.contoso.com/container/file2</D:href>
<D:location>https://www.contoso.com/othercontainer/file2.bak</D:location>
<D:status>HTTP/1.1 201 Created</D:status>
</D:response>
</D:multistatus>
See Also
Other Resources
COPY Method
Allow-Rename Header
target XML Element
location XML Element
href XML Element
propertybehavior XML Element