copy(objects, targetPath, options)

Use this method to copy objects within the content store from one location to another.

This method returns the searchPath, defaultName, and storeID of the objects copied. An error is returned if no objects are selected.

A copy operation generates a new value for the bibus » baseClass » searchPath property of the copied object and assigns a new, unique storeID. If an object containing an ID-based reference is copied and the referenced object is also copied, the reference contained within the copied object references the copy of the object referenced by the source object. Path-based references are not updated but will continue to work providing the search path is still valid.

To assign new names to the copies of the objects, use the content » copyRename(objects, targetPath, newNames, options) method.

Use of this method requires:

  • read permission for the source object

  • traverse permission for all ancestors of the source object

  • traverse permission for the source object if it has child objects and the bibus » copyOptions » recursive property is true

  • write permission for the target container object

  • traverse permission for the target container object and all its ancestors

  • write permission for the object being overwritten if one already exists in the new location

Signatures

Java and Apache Axis
 
public  com.cognos.developer.schemas.bibus._3.BaseClass[]  copy( 
com.cognos.developer.schemas.bibus._3.BaseClass[]  objects, 
com.cognos.developer.schemas.bibus._3.SearchPathSingleObject 
targetPath,  com.cognos.developer.schemas.bibus._3.CopyOptions  options) 
C# .NET
 
public  baseClass[]  copy(baseClass[]  objects,  searchPathSingleObject 
targetPath,  copyOptions  options) 
Example: Using the copy(objects, targetPath, options) Method with the Content Manager Service in Java

The following Java code snippet demonstrates how to use the content » copy(objects, targetPath, options) method with the Content Manager service.

To see this code in context, view the Java sample HandlersCS/CSHandlers.java. For more information about the samples, see Code samples and language-specific coding practices.

 
return  connection.getCMService().copy( 
		bc,  new  SearchPathSingleObject(targetPath),  new  CopyOptions()); 
 
Example: Using the copy(objects, targetPath, options) Method with the Content Manager Service in C# .NET

The following C# code snippet demonstrates how to use the content » copy(objects, targetPath, options) method with the Content Manager service.

To see this code in context, view the C# sample Copy/Copy.cs. For more information about the samples, see Code samples and language-specific coding practices.

 
baseClass[]  bcaCopyResults  =  cBICMS.copy(bcaCopy,  targetPathSO,  cpOptions); 
 
if  (bcaCopyResults.GetLength(0)  >  0) 
{ 
	//returns  the  number  of  successfully  copied  baseClass  objects 
	resultMessage  =   
			"...the  report  has  been  successfully  copied  to  :  "  + 
			targetPath  +   
			".\n"; 
	return  true; 
} 
 

References

Part of the following method sets:
Implemented by the following services:

The services that implement the copy method, along with the associated SOAP actions, are listed in the following table.

Table 1. Services implementing the copy method.

Service

SOAP Action

contentManagerService

http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201404/

Input parameters

Use the following parameters when calling this method.

objects

Specifies the objects to be copied.

The bibus » baseClass » searchPath property of each object is used to select the object.

This argument

  • is an array of type bibus » baseClass

    is encoded as type tns:baseClassArray

targetPath

Specifies the target location for the copies of the objects. This parameter must select a single container object that must be writable in the current security context.

This argument

options

Specifies the options for the content » copy(objects, targetPath, options) method.

This argument

Return values

This method returns the following values.

result

Returns the bibus » baseClass » defaultName property, the bibus » baseClass » searchPath property, and the bibus » baseClass » storeID property for each copy of an object.

This result

  • is an array of type bibus » baseClass

    is encoded as type tns:baseClassArray