This is an article in a series of Sitecore how-to articles. These articles are meant to be quick guides to accomplish various tasks within Sitecore. The how-to articles have proven to be very helpful internally at One North Interactive https://www.onenorth.com. These articles assume working Sitecore knowledge. I just wanted to share the articles with the community. Hopefully you find them helpful.
Sitecore has a built-in tool that allows you to quickly export content in XML format. It has a very basic functionality out of the box, but could easily and quickly be customized to add custom business rules as needed.
Out of the box, you can generate the export by following these steps:
- Login as admin.
- Navigate to Control Panel → Localization → Export Languages (in Sitecore 7.5 and below it’s Control Panel → Globalization → Export Languages).
- Select a language (most likely English) and select a top-level Sitecore Item that will serve as a ‘root’ element for your export. Then click ‘Next’, and once the export completes, you should be able to get full XML export.
There are various problems with this out-of-the-box approach: it doesn’t include any ‘Shared’ fields, since technically these fields are not ‘translatable’. By default, it is exporting all translatable fields, including the ones only used by Sitecore admins (like Display name, etc). For media items, the urls may not be correct, etc.
Here is what you need to customize this export:
- Sitecore.Support.90534 patch - certain versions of Sitecore inject css in XML (this happened to me in 7.5 and 6.6, but I believe it also affects other versions) - make sure to install it if you see css references in your XML. More info about this patch is here: https://community.sitecore.net/developers/f/8/t/8075. You can download it here: Sitecore.Support.90534-220.127.116.11 (1).zip
- Decomplie Sitecore.Shell.Applications.Globalization.ExportLanguage.ExportLanguageForm class from Sitecore.Client assembly, create a new class from it and alter the behavior. The changes will most likely need to happen in the ExportItem method.
- Copy from your website folder and add this file to your project: \sitecore\shell\Applications\Globalization\ExportLanguage\ExportLanguage.xml. You will need to modify the following namespace in this file
- replace it with your new namespace/class class.
- Once you make all updates, follow the steps above to generate a new export.
We have used this export approach several times, mostly for clients that required a data dump.