There is an issue that I would like to get some helps/advices. I'm creating a method in C# using Metadata API to deploy destructive changes to delete custom field as following:

  1. Create an empty package.xml file:

  2. Create destructivechanges.xml file with following content: Lead.xxxxx__c

  3. Zip those files to a file name: deletefield.zip

  4. Using following code to deploy changes:

var zipBytes = File.ReadAllBytes(@"DeleteField.zip");

var base64zipbytes = System.Text.Encoding.UTF8.GetBytes(Convert.ToBase64String(zipBytes));

var result = _metadataService.deploy(base64zipbytes, new DeployOptions() { purgeOnDelete = true });

var deployResult = _metadataService.checkDeployStatus(result.id, true);

  1. I checked that the deployResult is done and it is success. However, the deployment detail is empty. Check in the UI at /changemgmt/monitorDeployment.apexp and see that it is also success but the details is empty.

What did I do wrong?

Thanks, Phuc.

1 Answer 1


I just ran into a very similar issue in Deleting custom object via destructiveChanges.xml and Metadata API deploy().

In that case I found I needed to set the DeployOptions.singlePackage property to true. Apparently the example package and destructiveChanges.xml they provide in the documentation represent a single package rather than a set when they are the only files in the zip.

Also, I don't believe you need to manually base64 encode the zip file and then extract the bytes. Instead, just send the raw bytes of the zip file (assuming you are using the .NET generated proxy classes for the SOAP web service).


var result = _metadataService.deploy(zipBytes, 
    new DeployOptions() { purgeOnDelete = true, singlePackage = true });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.