How can I delete a Development Package (not an Installed Package) programatically?

Under Setup > Create > Packages, I have deployed “packages” with prefix 033

Under Setup > App Setup > Installed Packages, I have installed “packages” also with prefix 033

I understand that it is possible to retrieve Installed Packages using the ant sf:retrieve tool:

<types>
    <members>*</members>
    <name>InstalledPackage</name>
</types>

But I’m looking for Development Packages (like those created with sf:deploy) so I can destroy them.

package-menu

Is there a way to delete these guys (eg destructiveChanges.xml) without using the UI?

Answer

I’m pretty familiar with the Metadata API and deletion of Package ‘definitions’ is not supported presently it appears. The only thing i can think is accessing the Delete action via the page URL’s, which is not ideal of course since its not supported.

I did also try this in destructiveChanges.xml, it did not work sadly. I should clarify, it did not error, which gave me some hope, but in the end the unmanaged package Test remained.

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Test</fullName>
    <version>28.0</version>
</Package> 

And this…

<target name="undeploypackage">
    <sf:deploy
        username="${sf.username}"
        password="${sf.password}"
        singlepackage="true"
        deployroot="${basedir}/undeploypackage"/>
</target>

Attribution
Source : Link , Question Author : Matt and Neil , Answer Author : Andrew Fawcett

Leave a Comment