Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

ApplyResourcePackage
ChangeResourceOwner
CopyResource
DeleteResource
DeleteResourceData
EnumerateReferences
EnumerateResourceData
EnumerateResources
EnumerateResources
EnumerateUnmanagedData
GetRepositoryContent
GetRepositoryHeader
GetResourceContent
GetResourceData
GetResourceHeader
InheritPermissionsFrom
MoveResource
RenameResourceData
ResourceExists
SetResource
SetResourceData
UpdateRepository
virtual void MgResourceService::MoveResource | ( | MgResourceIdentifier * | sourceResource,
|  | MgResourceIdentifier * | destResource,
|  | bool | overwrite |
| ) |  |  | `[pure virtual]`
Moves an existing resource to another location. Remarks: You can also use this method to rename a resource. .NET Syntax
`virtual void MoveResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, bool overwrite);`
Java Syntax
`virtual void MoveResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, boolean overwrite);`
PHP Syntax
`virtual void MoveResource(MgResourceIdentifier sourceResource, MgResourceIdentifier destResource, bool overwrite);`
  Parameters:
  | sourceResource | (MgResourceIdentifier) Resource to be moved. This can be a document or folder. If it is a folder, this method also moves the contents of the folder and all folders below it. If it is a folder, you must include the trailing slash in the identifier.
  | destResource | (MgResourceIdentifier) Where the resource should be moved 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 moves the file Library://Geography/World.MapDefinition to Library://Atlas/Oceans.MapDefinition:
     // Assuming $resourceService has already been initialized
     $oldPath = new MgResourceIdentifier("Library://Geography/World.MapDefinition");
     $newPath = new MgResourceIdentifier("Library://Atlas/Oceans.MapDefinition");
     $resourceService->MoveResource($oldPath, $newPath, true);
This example moves the folder Library://Geography/ to Library://World Geography/:
     $oldPath = new MgResourceIdentifier("Library://Geography/");
     $newPath = new MgResourceIdentifier("Library://World Geography/");
     $resourceService->MoveResource($oldPath, $newPath, true);
This example renames Oceans.MapDefinition to Pacific Ocean.MapDefinition:
     /**************************************************************************/
     $oldPath = new MgResourceIdentifier("Library://Atlas/Oceans.MapDefinition");
     $newPath = new MgResourceIdentifier("Library://Atlas/Pacific Ocean.MapDefinition");
     $resourceService->MoveResource($oldPath, $newPath, true);
  Exceptions:
  | MgResourceNotFoundException |
  | MgDuplicateResourceException |
  | MgInvalidRepositoryTypeException |
  | MgInvalidRepositoryNameException |
  | MgInvalidResourcePathException |
  | MgInvalidResourceNameException |
  | MgInvalidResourceTypeException |
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.

Comments or suggestions? Send us feedback.