Friday, July 10, 2009 1:34 PM gperera

Dynamics CRM - Backup, Restore & Publish Customizations Programmatically

Here is a simple class you can use to backup, restore and publish dynamics crm customizations programmatically. Please keep in mind that dynamics crm customizations are additive, which means, if you import a set of customizations lets say a new attribute on the account entity and you restore a backup of the old customizations the new attribute on the account entity that was imported will not be deleted.

Usage
CrmCustomizations customizations = new CrmCustomizations(service);

You can backup to an xml file or a zip file by calling the Backup method. Backup method takes care of creating the xml or zip file by looking at the output file extension.
    bool backedup = customizations.Backup(@".\customizations_backup.xml");
    // or to a zip file
    backedup = customizations.Backup(@".\customizations_backup.zip");

To restore a backup call the Restore method. You can pass it a .zip file or a .xml file path.
    bool restored = customizations.Restore(@".\customizations.xml");

Once you have restored you need to publish the customizations, to publish call the Publish method. It will publish all customizations.
    bool published = customizations.Publish();

Download the class file

Enjoy!

Filed under:

Comments

# re: Dynamics CRM - Backup, Restore & Publish Customizations Programmatically

Thursday, August 20, 2009 4:53 PM by JAYAKUMAR JANAKIRAMAN

Thanks . This was useful

# re: Dynamics CRM - Backup, Restore & Publish Customizations Programmatically

Monday, October 05, 2009 1:16 PM by Sam Walker

Is the "Restore" function the same as the "Import Customizations" function?

# re: Dynamics CRM - Backup, Restore & Publish Customizations Programmatically

Tuesday, October 06, 2009 12:47 AM by gperera

Hi Sam

Yes it is

Leave a Comment

(required) 
(required) 
(optional)
(required)