Excel Add-In for Microsoft SharePoint

Build 24.0.8963

CopyDocument

Copies a document from the SharePoint library.

Execute

If the NewDocumentName parameter is not specified, the value specified in DocumentName will be used as the destination path. If the NewDocumentLibrary parameter is not specified, the value specified in DocumentLibrary will be used as the new library. In any case, at least one of these two parameters must be specified (they can't both be unspecified at the same time). The DocumentLibrary and DocumentName parameters on the other hand are always required. Refer to the query examples below:

EXEC CopyDocument DocumentLibrary = 'Documents', DocumentName = 'Source Folder/Subfolder/Source Document.txt', NewDocumentName = 'Destination Document.txt';
EXEC CopyDocument DocumentLibrary = 'Documents', DocumentName = 'Source Document.txt', NewDocumentLibrary = 'Destination Library';
EXEC CopyDocument DocumentLibrary = 'Documents', DocumentName = 'Source Folder/Subfolder/Source Document.txt', NewDocumentLibrary = 'Destination Library', NewDocumentName = 'Destination Document.txt';
If NewDocumentName is a folder (ends with a '/'), the document name from DocumentName will be used as the new file name instead. Refer to the query example below:
EXEC CopyDocument DocumentLibrary = 'Documents', DocumentName = 'Source Folder/Subfolder/Source Document.txt', NewDocumentLibrary = 'Destination Library', NewDocumentName = 'Destination Folder/Subfolder/';

Additionally, you can copy the document to a different site in your SharePoint instance by specifying its full URL. In this scenario, NewDocumentLibrary is required. Refer to the query example below:

EXEC CopyDocument DocumentLibrary = 'Documents', DocumentName = '/Source Folder/Subfolder/Source Document.txt', NewDocumentLibrary = 'Destination Library', NewDocumentName = 'https://mysite.sharepoint.com/sites/Destination%20Site/Destination%20Library/Destination%20Folder/Subfolder/Destination%20Document.txt';

Input

Name Type Description
DocumentName String The original document location relative to its library.
DocumentLibrary String The display name of the library in which the original document is stored.
NewDocumentLibrary String The display name of the library in which the copy document will be stored. If left blank, this will be the same as DocumentLibrary.
NewDocumentName String The copy document location relative to its new library. If left blank, this will be the same as DocumentName.

Result Set Columns

Name Type Description
Success Boolean Indicates whether the operation was successful or not.
Id String The Id of the document.
DocumentId String The document Id.
DocumentIdUrl String The URL of the document Id.
FileRef String The file reference of the document.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.8963