Share via


SP.File.copyTo Method (sp.js)

Copies the file to the destination URL.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

SP.File.copyTo()

Return value

Undefined

Remarks

Server must overwrite an existing file of the same name if bOverwrite is true.

REST resource endpoint

See File resource for more information.

Endpoint URI structure

http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)/files/getbyurl(filerelativeurl)/copyTo(strNewUrl,bOverWrite)

HTTP requests

This resource supports the following HTTP commands:

  • POST

POST syntax

POST http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)/files/getbyurl(filerelativeurl)/copyTo(strNewUrl,bOverWrite)

Resource parameters

  • strNewUrl

  • bOverWrite

Parameters

  • strNewUrl

  • bOverWrite