|
Copies an existing resource to another location.
.NET Syntax
virtual void CopyResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, bool overwrite);
|
Java Syntax
virtual void CopyResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, boolean overwrite);
|
PHP Syntax
virtual void CopyResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, bool overwrite);
|
- Parameters:
-
| sourceResource | (MgResourceIdentifier) Resource to be copied from. This can be a document or folder.
If it is a folder, this method also copies the contents of the folder and all folders below it. You must include the trailing slash in the identifier. |
| destResource | (MgResourceIdentifier) Where the resource should be copied to. |
| overwrite | (boolean/bool) Flag to determine whether or not the destination resource should be overwritten if it exists. |
- Returns:
- Returns nothing.
Example (PHP)
This example copies the file Library://Geography/World.MapDefinition to Library://Atlas/World Geography.MapDefinition: // Assuming $resourceService is already initialized.
$source_resourceID= new MgResourceIdentifier("Library://Geography/World.MapDefinition");
$destination_resourceID= new MgResourceIdentifier("Library://Atlas/World Geography.MapDefinition");
$resourceService->CopyResource($source_resourceID, $destination_resourceID, true);
This example copies the folder Library://Geography/ to Library://World/Oceans/: $source_resourceID= new MgResourceIdentifier("Library://Geography/");
$destination_resourceID= new MgResourceIdentifier("Library://World/Oceans/");
$resourceService->CopyResource($source_resourceID, $destination_resourceID, true);
- Exceptions:
-
- Note:
- When copying a folder with the "overwrite" flag turned on, if the destination folder already exists, then only the children in the destination folder that have the same names as those in the source folder are overwritten. The rest should are left intact.
|