Enable the export of custom facets to a CSV file
Use the List Manager API to enable the export of contacts' custom facets.
You can create custom contact facets to include contact information that your organization wants to track, for example, addresses, country, or company.
If you want these custom contact facets to appear in the CSV file when you export lists of contacts from the List Manager, you must configure the listManagement.exportContacts pipeline.
Note
You must index new custom contact facets before you export them from the List Manager.
To enable the export of custom facets to a CSV file:
Create a new
GetCustomContactRowsclass, making sure it is inherited from the existing classSitecore.ListManagement.ContentSearch.Pipelines.ExportContacts.GetContactRows, Sitecore.ListManagement.ContentSearch.Override the protected
GetRowmethod to export the relevant facets, for example,Company.public class GetCustomContactRows : GetContactRows { protected override IEnumerable<string> GetRow(IEnumerable<ContactData> contacts) { Assert.ArgumentNotNull(contacts, "contacts"); var sep = this.Delimiter.ToString(CultureInfo.InvariantCulture); yield return string.Join(sep, "Identifier", "FirstName", "Surname", "Email", "Company"); foreach (var contact in contacts) { yield return string.Join(sep, contact.Identifier, contact.FirstName, contact.Surname, contact.PreferredEmail, contact["contact.Company"]); } } }In the
App_Config\Include\ListManagement\Sitecore.ListManagement.configfile, in thelistManagement.exportContactspipeline, delete the existingGetContactRowsprocessor and register the new one:<listManagement.exportContacts> <processor type="<custom namespace>.GetCustomContactRow, <custom assembly>" /> <processor type="Sitecore.ListManagement.ContentSearch.Pipelines.ExportContacts.GetContactsStream, Sitecore.ListManagement.ContentSearch" /> </listManagement.exportContacts>