AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

virtual void MgResourceService::DeleteResource ( MgResourceIdentifier resource  )  [pure virtual]

Deletes an existing resource and its associated data from the repository.

.NET Syntax
virtual void DeleteResource(MgResourceIdentifier resource);
Java Syntax
virtual void DeleteResource(MgResourceIdentifier resource);
PHP Syntax
virtual void DeleteResource(MgResourceIdentifier resource);

Parameters:
resource (MgResourceIdentifier) Resource identifier specifying the resource to delete. This can be a document or a folder.
If it is a folder, this method deletes that folder, all resources in the folder, and any subfolders below it.
If it is a folder, you must include the trailing slash in the identifier.
Returns:
Returns nothing.
Example (PHP)
This example deletes a single resource:
 // Assuming $resourceService is already initialized
 $resourceID = new MgResourceIdentifier("Library://Maps/World.MapDefinition");
 $resourceService->DeleteResource($resourceID);

This example deletes a folder and all items beneath it:
 $resourceID = new MgResourceIdentifier("Library://Maps/");
 $resourceService->DeleteResource($resourceID);

This deletes all the resources in the library:
 $resourceID = new MgResourceIdentifier("Library://");
 $resourceService->DeleteResource($resourceID);

Exceptions:
MgInvalidResourceTypeException 
Note:
The API generates an exception if you try to delete a non-existent resource.