Newer Version Available
deleteMetadata()
Syntax
Usage
Use the deleteMetadata() call to delete any component that extends Metadata. All components must be of the same type in the same call. For more details, see Metadata Components and Types.
This call executes synchronously, which means that the call returns only when the operation completes.
Starting in API version 34.0, this call supports the AllOrNoneHeader header. By default, if the AllOrNoneHeader isn’t used in any API version, this call can delete a partial set of records for records with no errors (equivalent to AllOrNoneHeader=false). If AllOrNoneHeader is set to true, no records are deleted if one or more records cause a failure.
Version
Available in API version 30.0 and later.
Permissions
Your client application must be logged in with the Modify All Data or Modify Metadata Through Metadata API Functions permission.
Rules and Guidelines
When deleting components, consider the following rules and guidelines:
- Your client application must be logged in with sufficient access rights to delete individual components within the specified component. For more information, see “Factors that Affect Data Access” in the SOAP API Developer Guide.
- In addition, you might also need permission to access this component’s parent component.
- To ensure referential integrity, this call supports cascading deletions. If you delete a parent component, you delete its children automatically, as long as each child component can be deleted.
Basic Steps for Deleting Metadata Components
Use the following process to delete metadata components:
- Determine the metadata type of the components you want to delete and the fullName of each component to delete. You can delete only components of the same type in a single call. The full names must match one or more full names returned by the listMetadata() call. See Metadata for more details on the fullName field.
- Invoke the deleteMetadata() call. For the
first argument, pass in the name of the metadata type. For the second argument,
pass in an array of full names corresponding to the components you wish to
delete.
A DeleteResult object is returned for each component you try to delete. It contains information about whether the operation was successful, the name of the deleted component, and any errors returned if the operation wasn’t successful.