Class DataExporter
Export pages to ziped XML format.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Enterprise
Assembly: EPiServer.Enterprise.dll
Version: 9.12.2Syntax
[ServiceConfiguration]
[ServiceConfiguration(typeof(IDataExporter), Lifecycle = ServiceInstanceScope.Transient)]
public class DataExporter : ExportImportBase, ITransferContext, IContentTransferContext, ITransferHandlerContext, IDataExporter, IDisposable
Examples
Example that demonstrates how to export a page to a file
Constructors
DataExporter()
Initializes a new instance of the DataExporter
Declaration
public DataExporter()
DataExporter(PropertyContentReferenceListTransform, PropertyJsonTransform)
Initializes the DataExporter class. And set up the default property transform event handlers for export.
Declaration
[Obsolete("Use alternative constructor")]
public DataExporter(PropertyContentReferenceListTransform propertyContentReferenceListTransform, PropertyJsonTransform propertyJsonTransform)
Parameters
Type | Name | Description |
---|---|---|
PropertyContentReferenceListTransform | propertyContentReferenceListTransform | |
PropertyJsonTransform | propertyJsonTransform |
DataExporter(IDataExportEventsRaiser, IDataExportEvents, IVisitorGroupRepository, RawContentRetriever, IContentRepository, IPermanentLinkMapper, IContentTypeRepository, IContentProviderManager, ContentTypeAvailabilityService, IAvailableSettingsRepository, IContentTransfer)
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes the DataExporter class. And set up the default property transform event handlers for export.
Declaration
public DataExporter(IDataExportEventsRaiser eventRegister, IDataExportEvents exportEvents, IVisitorGroupRepository visitorGroupRepository, RawContentRetriever rawContentRetriever, IContentRepository contentRepository, IPermanentLinkMapper permanentLinkMapper, IContentTypeRepository contentTypeRepository, IContentProviderManager contentProviderManager, ContentTypeAvailabilityService contentTypeAvailabilityService, IAvailableSettingsRepository availableSettingsRepository, IContentTransfer contentTransfer)
Parameters
Type | Name | Description |
---|---|---|
IDataExportEventsRaiser | eventRegister | |
IDataExportEvents | exportEvents | |
EPiServer.Personalization.VisitorGroups.IVisitorGroupRepository | visitorGroupRepository | |
RawContentRetriever | rawContentRetriever | |
IContentRepository | contentRepository | |
IPermanentLinkMapper | permanentLinkMapper | |
IContentTypeRepository | contentTypeRepository | |
IContentProviderManager | contentProviderManager | |
ContentTypeAvailabilityService | contentTypeAvailabilityService | |
IAvailableSettingsRepository | availableSettingsRepository | |
IContentTransfer | contentTransfer |
Fields
CategoryKey
Declaration
public const string CategoryKey = "Category"
Field Value
Type | Description |
---|---|
System.String |
ContentLanguageKey
Declaration
public const string ContentLanguageKey = "ContentLanguage"
Field Value
Type | Description |
---|---|
System.String |
ContentTypeKey
Declaration
public const string ContentTypeKey = "ContentType"
Field Value
Type | Description |
---|---|
System.String |
DynamicPropertyKey
Declaration
public const string DynamicPropertyKey = "DynamicProperty"
Field Value
Type | Description |
---|---|
System.String |
ExporterVersion
The exported file version.
Declaration
public const int ExporterVersion = 4
Field Value
Type | Description |
---|---|
System.Int32 |
FrameKey
Declaration
public const string FrameKey = "Frame"
Field Value
Type | Description |
---|---|
System.String |
TabDefinitionKey
Declaration
public const string TabDefinitionKey = "TabDefinition"
Field Value
Type | Description |
---|---|
System.String |
VisitorGroupKey
Declaration
public const string VisitorGroupKey = "VisitorGroup"
Field Value
Type | Description |
---|---|
System.String |
Properties
Culture
Gets or sets the culture to use.
Declaration
public CultureInfo Culture { get; set; }
Property Value
Type | Description |
---|---|
System.Globalization.CultureInfo | The culture. |
ExportableItems
Can be used to add instances to the export package
Declaration
public IDictionary<string, IList> ExportableItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Collections.IList> | A collection that instances can be added to |
Remarks
Supported key/types are ContentType/ContentType, Category/Category, VisistorGroup/EPiServer.Personalization.VisitorGroups.VisitorGroup, TabDefinition/TabDefinition, Frame/Frame and ContentLanguages/System.Globalization.CultureInfo.
NumberOfExportedCategories
Declaration
public int NumberOfExportedCategories { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NumberOfExportedContentTypes
Declaration
public int NumberOfExportedContentTypes { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NumberOfExportedDynamicProperties
Declaration
public int NumberOfExportedDynamicProperties { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NumberOfExportedFrames
Declaration
public int NumberOfExportedFrames { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NumberOfExportedTabs
Declaration
public int NumberOfExportedTabs { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NumberOfExportedVisitorGroup
Gets or sets the number of exported visitor group.
Declaration
public int NumberOfExportedVisitorGroup { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of exported visitor group. |
RequiredSourceAccess
Gets or sets the required access level for page exporting.
Declaration
public AccessLevel RequiredSourceAccess { get; set; }
Property Value
Type | Description |
---|---|
AccessLevel | The required source access. |
Status
Gets status information about the ongoing export job
Declaration
public IExportStatus Status { get; }
Property Value
Type | Description |
---|---|
IExportStatus |
Methods
Close()
Closes the under laying XML writer.
Declaration
public void Close()
Dispose()
Disposes the exporter and close the under laying XML writer.
Declaration
public void Dispose()
Export()
Starting the export. The export can be done several times to empty the exporter.
Declaration
public void Export()
Export(Stream, IEnumerable<ExportSource>, ExportOptions)
Export the specified data to an export package specified by System.IO.Stream
Declaration
public ITransferLog Export(Stream stream, IEnumerable<ExportSource> sourceRoots, ExportOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to where the export packages is saved |
System.Collections.Generic.IEnumerable<ExportSource> | sourceRoots | The list of content roots to export |
ExportOptions | options | Specify settings for how the export should be done |
Returns
Type | Description |
---|---|
ITransferLog |
Remarks
Potential errors and warnings are logged to returned logger
Continuous progress can be retreieved from Status.
ExportContent(XmlTextWriter, ContentReference, IContentTransferContext, ITransferContentData)
Exports one content item to the XML writer.
Declaration
protected virtual void ExportContent(XmlTextWriter xml, ContentReference contentToExport, IContentTransferContext context, ITransferContentData transferContent)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlTextWriter | xml | The XML. |
ContentReference | contentToExport | The content to export. |
IContentTransferContext | context | The context. |
ITransferContentData | transferContent | Content of the transfer. |
Finalize()
Declaration
protected void Finalize()
GetRawContentInfo(ContentReference)
Gets the RawContentInfo corresponding to the referenced content
Declaration
protected RawContentInfo GetRawContentInfo(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
Returns
Type | Description |
---|---|
RawContentInfo | A RawPageInfo instance |
GetRawPageInfo(PageReference)
Declaration
[Obsolete("Use GetRawContentInfo instead")]
protected RawPageInfo GetRawPageInfo(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink |
Returns
Type | Description |
---|---|
RawPageInfo |
NotifyDynamicPropertiesExporting(IList<PropertyDefinition>)
Notifies the transfer handlers about transfering of dynamic properties.
Declaration
protected virtual void NotifyDynamicPropertiesExporting(IList<PropertyDefinition> propertyDefinitions)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<PropertyDefinition> | propertyDefinitions | The property definitions. |
NotifyExportHandlers(ITransferContentData)
Notifies the transfer handlers about transfering of page.
Declaration
protected virtual void NotifyExportHandlers(ITransferContentData transferContent)
Parameters
Type | Name | Description |
---|---|---|
ITransferContentData | transferContent | The transfer page. |
NotifyExportHandlers(IEnumerable<ContentType>)
Notifies the transfer handlers about transfering of blocktypes.
Declaration
protected virtual void NotifyExportHandlers(IEnumerable<ContentType> conentTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ContentType> | conentTypes | The blocktypes. |
OnExportProperty(TransformPropertyEventArgs)
Raises the ExportPropertyEvent event.
Declaration
public override void OnExportProperty(TransformPropertyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
TransformPropertyEventArgs | e | The TransformPropertyEventArgs instance containing the event data to export a property. |
Overrides
Events
ContentExported
Occurs after a file has been exported
Declaration
[Obsolete("Use IDataExporterEvents to register to event handlers")]
public static event ContentExportedEventHandler ContentExported
Event Type
Type | Description |
---|---|
ContentExportedEventHandler |
ContentExporting
Occurs before a content item is exported
Declaration
[Obsolete("Use IDataExporterEvents to register to event handlers")]
public static event ContentExportingEventHandler ContentExporting
Event Type
Type | Description |
---|---|
ContentExportingEventHandler |
Exporting
Occurs before an export action is triggered.
Declaration
[Obsolete("Use IDataExporterEvents to register to event handlers")]
public static event EventHandler Exporting
Event Type
Type | Description |
---|---|
System.EventHandler |
ExportPropertyEvent
Event to handle the export of properties.
{
IContentTransferContext transferContext = sender as IPageTransferContext;
if (transferContext == null // The transfer context should not be null
|| e == null // The event args shuld exists //TODO: Write export transformation code for MyProperty e.IsHandled = true; // Signal that its handled to all other Export event handlers.
}ExportPropertyEvent += new EventHandler<TransformPropertyEventArgs>(MyProperty.ExportEventHandler);
public static void ExportEventHandler(object sender, TransformPropertyEventArgs e)
|| e.IsHandled // and not be handled by another handler
|| e.PropertySource == null // and the property type should be the correct type.
|| e.PropertySource.TypeName == null
|| e.PropertySource.TypeName.CompareTo("Development.MyProperty") != 0)
{
return;
}
Declaration
[Obsolete("Use IDataExporterEvents to register to event handlers")]
public static event EventHandler<TransformPropertyEventArgs> ExportPropertyEvent
Event Type
Type | Description |
---|---|
System.EventHandler<TransformPropertyEventArgs> |
FileExported
Occurs after a file has been exported
Declaration
[Obsolete("Use IDataExporterEvents to register to event handlers")]
public static event FileExportedEventHandler FileExported
Event Type
Type | Description |
---|---|
FileExportedEventHandler |
FileExporting
Occurs before a file is exported
Declaration
[Obsolete("Use IDataExporterEvents to register to event handlers")]
public static event FileExportingEventHandler FileExporting
Event Type
Type | Description |
---|---|
FileExportingEventHandler |
PageExported
Occurs after a page has been exported
Declaration
[Obsolete("Use ContentExported instead")]
public static event PageExportedEventHandler PageExported
Event Type
Type | Description |
---|---|
PageExportedEventHandler |
PageExporting
Occurs before a page is exported
Declaration
[Obsolete("Use ContentExporting instead")]
public static event PageExportingEventHandler PageExporting
Event Type
Type | Description |
---|---|
PageExportingEventHandler |
ParsingUrl
Occurs every time a relative URL is found in a property.
Declaration
public static event ParseUrlEventHandler ParsingUrl
Event Type
Type | Description |
---|---|
ParseUrlEventHandler |
Remarks
The source of this event may not always be a DataExporter class, it is also used during a HTML mirroring.