This blog post is based on the Article Add Export to File Functionality in Sitecore's Search Options by Dean Mark Soriano.

To follow this guidance as well as possible it is required that you have already completed the steps from this blog post:
https://sitecore.namics.com/2017/11/03/customized-sitecore-search-view-list-buckets-values-in-dynamic-placeholders.

2017-11-02_14-43-54

Now we want to export the result list into an excel file.

First, create a new Item called "Export To File" under "System/Settings/Buckets/Settings/Search Operations/User Defined/"
with following field values:

  • Type: bucket:exporttofile
  • List Name: Export To File
  • Enabled: true

2017-11-03_15-34-12

Then add a command for "bucket:exporttofile" in a config file:
(The other settings in this sample are reminders from the previous article: https://sitecore.namics.com/2017/11/03/customized-sitecore-search-view-list-buckets-values-in-dynamic-placeholders)

Then create a class for the code behind (in our example it is called "ExportSearchToFileCommand.cs"). You can take the following code as a reference point (Please keep in mind to use your own mechanism to get a configuration item and that we used our own ORM.):

The delimiter for the Excel/CSV file can be configured in a configuration item. Normaly you would use a semicolon. In my case, the file is only readeable in Excel when it is in UTF-8 format.

Because of the fact that we use a dynamic configuration for the bucket we have to create a model class:

Howto export to file:
ExportToFile