Inside a custom developed timer job, we're doing a selective list migration between an internal and external farm based on list item attributes, e.g. only copy to external if "Is Public" is checked. Here's the rough code for how we're handling changes on each list:

SPChangeCollection changes = list.GetChanges(changeToken);

foreach (SPChange change in changes)
    var itemChange = change as SPChangeItem;

    if (change.ChangeType == SPChangeType.Add || change.ChangeType == SPChangeType.Update)
        //Check "Is Public" field.
        //If set, create and add new SPExportObject to settings.ExportObjects
    else if (change.ChangeType == SPChangeType.Delete)
        //WHAT DO WE DO HERE?

The problem we're having is with the handling of deleted items. If we add the deleted item to settings.ExportObjects and run the export, we get an error:

The object of type ListItem with Id [GUID] that was configured as part of the Export Settings does not exist.

The only method I've found to add a deletion to an export file involves:

  1. Saving a list of the deleted items as we step through the changes.
  2. After exporting the changes, open up the CAB file, edit the manifest.xml, and add SPObject elements with the IsDeleted flag set to true for each item we want to remove.

Is there a way to "deploy" a deletion using the Content Deployment API? Is there an overall simpler way for us to attack this entire problem? Should we abandon the deployment API and switch to an alternative method of moving the items between farms?

1 Answer 1


The only way I've found is what you are doing.

The issue is that when you are looking for the GUID of the file that you deleted, you no longer have it, therefore you cannot make reference to its GUID. It's already been deleted. Save the GUID before it's deleted in the source SPWeb. Get access, and add it, to the deployment batch by just what you described: manually editing the manifest.

It's the only method found so far!

Good luck (O;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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