CopyDocument
Copies a document to a specified destination within SharePoint. Helps in content duplication and archiving.
Stored Procedure-Specific Information
To execute this procedure, enter:EXEC CopyDocument DocumentLibrary='Test Library 1', DocumentName='/Test Folder 1/Test Nested Folder 1/my_file.txt', NewDocumentLibrary='Documents'
Input
| Name | Type | Required | Description |
| DocumentName | String | True | The relative path of the original document within its document library. Example: 'Folder1/OriginalFile.docx'. |
| DocumentLibrary | String | True | The display name of the SharePoint document library where the original document is stored. Example: 'Shared Documents'. |
| NewDocumentLibrary | String | False | The display name of the target document library where the copied document will be stored. If left blank, the document remains in the same library as the original. |
| NewDocumentName | String | False | The relative path and file name for the copied document in the new library. If left blank, the document retains the same name as the original. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the document copy operation was successful. Returns 'true' for success and 'false' for failure. |
| Id | String | The unique identifier assigned to the copied document after completion. |
| DocumentId | String | The document ID assigned to the copied file. |
| DocumentIdUrl | String | The URL where the copied document can be accessed via its document ID. |
| FileRef | String | The SharePoint file reference path of the copied document. |