COPY

Used to copy a file or a folder from one document library to another or from one location to another within the same library.

Note! When copying a folder, all documents and subfolders under that folder will also be copied. The name of the file or folder on the destination can be different from its original name.

Syntax

COPY(string sourceListName, string sourceFile, string destinationListName, string destinationFile);

Example: to copy the file named helloworld.txt from folder Textfiles in document library Shared Documents to the root folder:

CALL COPY('Shared Documents', 'Textfiles/helloworld.txt', 'Shared Documents', 'helloworld.txt');

Example: to copy the folder named Images from document library Shared Documents to another document library called New Shared Documents:

CALL COPY('Shared Documents', 'Images', 'New Shared Documents', 'Images');

Code examples

Copy document

using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand(@"CALL COPY('Shared Documents', 'Images/bendsoft.jpg', 'Shared Documents', 'Images/bendsoft_backup.jpg')", connection))
    {
        command.ExecuteNonQuery();
    }
}


Skip Navigation Links.

Visa     MasterCard