You are here

You are here

Copy a Document

The Copy method is used to copy any SCMBaseObject, including documents.  The method requires the object Id of the source document and the target folder to copy to.  The result object includes both the source and new folder as well as the document information that participated in the copy.  

Vertical Tabs

c#
string documentId = "<Source document Id retrieved by other method calls>";
string folderId = "<Target folder Id retrieved by other method calls>";
 
SCMCopyResults copyResults = springCMService.Copy(token, SCMObjectType.Document, documentId, folderId);
SCMDocumentCopyResult documentCopyResult = copyResults.DocumentResults[0];
 
Console.WriteLine("Copied source document id {0} from source folder {1} to target id {2} in target folder {3}",
	documentCopyResult.SourceDocId, documentCopyResult.SourceFolderName,
	documentCopyResult.NewDocId, documentCopyResult.NewFolderName);
java
String documentId = "<Source document Id retrieved by other method calls>";
String folderId = "<Target folder Id retrieved by other method calls>";
 
SCMCopyResults copyResults = springCMService.copy(token, SCMObjectType.Document, documentId, folderId);
SCMDocumentCopyResult documentCopyResult = copyResults.getDocumentResults()[0];
 
System.out.format("Copied source document id %s from source folder %s to target id %s in target folder %s\n",
 documentCopyResult.getSourceDocId(), documentCopyResult.getSourceFolderName(),
 documentCopyResult.getNewDocId(), documentCopyResult.getNewFolderName());