Start of Main Content

In my work as a Sitecore developer, I have had many occasions where clients have requested audits of their Sitecore content, such as needing to know all the items in a certain folder with the values of particular fields for those items.  For these requests, I would create a custom utility page so that they could export the data they needed, but as I found I was writing basically the same code over and over with different hardcoded values, I decided to create a reusable module that could handle all of these requests dynamically. This module works on all versions of Sitecore through 8.2.

The  module can be downloaded from the Sitecore Marketplace: https://marketplace.sitecore.net/Modules/C/Content_Export_Tool.aspx?sc_lang=en

Setup

Setup is simple. All you need to do is download the package Content Export Tool.zip and install this in your Sitecore instance using the Installation Wizard. The Content Export button should appear in the Start Menu once Sitecore restarts. That’s it!

How to Use

The tool allows the user to run exports ranging from minimal data to hundreds of fields. If the user clicks the Run Export button with no fields filled out/checked off, it will return a spreadsheet with the item path of every item in the Sitecore content tree. The following fields can be used to further customize the data:

  • Database – Select which database to retrieve content from. The Database dropdown is populated with all of the available databases for the website.
  • Include Ids – Check this box to include the Guid IDs of each item
  • Start Item – If this field is blank, the entire content tree will be scanned. If this field is populated, then the export will only include items beneath and including the item specified. Start Item can be specified by path or ID. The Start Item can be manually entered, or you can use the Browse button to search the content tree for the item you want (Browse can take a while to load).
  • Fast Query – Enter a fast query to select the items you want to export. This field overrides the Start Items. The tool will only export items returned by the fast query. You can use the Test button to see whether the query works and how many items it will return.
  • Templates – If this field is blank, all items under the start node will be included. If templates are selected, only items of the selected template types will be included. Templates can be specified by name or ID; if name is used, then if multiple templates have the same name, items of all templates with that name will be included. You can use the Browse button to choose template names from the Sitecore tree, or enter names or IDs manually.
  • Include Template Name – Check this box to include the template name of each item in the spreadsheet
  • Fields – Enter the names or IDs of all the fields that you want to get the values of. The tool determines the type of each field and handles the data accordingly; this can handle string, rich text, image, link, droplist, multilist, and checkbox fields. Fields names or IDs can be manually entered, or you can use Browse to select fields. If the Templates field is populated, then Browse will only suggest fields that belong to selected templates.
  • Include linked item IDs – This will include the item ID for any field that links to an item, such as images, links, droplists, and multilists (the linked item path is returned by default).
  • Include raw HTML – This will include the raw HTML that is returned by image and link fields
  • Workflow – This includes the workflow that each item uses
  • Workflow State – This includes the current workflow state that the item is in
  • Get All Language Versions – This includes the language of each item

Settings can be saved in case you want to run the same export multiple times. The Save Settings button will save the current configuration (you must enter a name to save as first). Selecting settings from the dropdown will populate all of the fields based on the saved configuration. You can delete a saved configuration when it is currently selected using the Delete button. You cannot save multiple configurations with the same name, but if you want to overwrite an existing configuration, you can enter the name of that configuration and click Save Settings (you will be prompted to confirm whether you want to overwrite). 

Conclusion

The Content Export Tool can make auditing Sitecore content much easier for both developers and Sitecore users. It makes auditing content simple: you can easily find the locations of all items of a particular template type; retrieve the values of the fields of thousands of items; get all of the items that exist in a particular folder; and many more possibilities. The code is open source and easily customizable as well. I hope you will find this module useful!

Published:

Latest Ideas

Take advantage of our expertise with your next project.