Class DataExporter
Export pages to ziped XML format.
Inheritance
Inherited Members
Namespace: EPiServer.Enterprise
Assembly: EPiServer.Enterprise.dll
Version: 8.11.0Syntax
[ServiceConfiguration]
public class DataExporter : ExportImportBase, ITransferContext, IContentTransferContext, ITransferHandlerContext, 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
public DataExporter(PropertyContentReferenceListTransform propertyContentReferenceListTransform, PropertyJsonTransform propertyJsonTransform)
Parameters
Type | Name | Description |
---|---|---|
PropertyContentReferenceListTransform | propertyContentReferenceListTransform | |
PropertyJsonTransform | propertyJsonTransform |
Fields
ExporterVersion
The exported file version.
Declaration
public const int ExporterVersion = 4
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
ContentRepository
Declaration
public Injected<IContentRepository> ContentRepository { get; set; }
Property Value
Type | Description |
---|---|
Injected<IContentRepository> |
Culture
Gets or sets the culture to use.
Declaration
public CultureInfo Culture { get; set; }
Property Value
Type | Description |
---|---|
System.Globalization.CultureInfo | The culture. |
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. |
RawContentRetriever
Declaration
public Injected<RawContentRetriever> RawContentRetriever { get; set; }
Property Value
Type | Description |
---|---|
Injected<RawContentRetriever> |
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. |
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()
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. |
ExportPage(XmlTextWriter, PageReference, IPageTransfer, IPageTransferContext, AccessLevel)
Exports one page to the XML writer.
Declaration
[Obsolete("Use ExportContent ExportContent(XmlTextWriter xml, ContentReference contentToExport, IContentTransfer exporter, IContentTransferContext context, AccessLevel requiredSourceAccess)")]
protected virtual void ExportPage(XmlTextWriter xml, PageReference pageToExport, IPageTransfer exporter, IPageTransferContext context, AccessLevel requiredSourceAccess)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlTextWriter | xml | The XML writer to export the page to. |
PageReference | pageToExport | A reference to the page to export. |
IPageTransfer | exporter | The exporter. |
IPageTransferContext | context | The transfer context to use. |
AccessLevel | requiredSourceAccess | The required source access. |
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
public static event ContentExportedEventHandler ContentExported
Event Type
Type | Description |
---|---|
ContentExportedEventHandler |
ContentExporting
Occurs before a content item is exported
Declaration
public static event ContentExportingEventHandler ContentExporting
Event Type
Type | Description |
---|---|
ContentExportingEventHandler |
Exporting
Occurs before an export action is triggered.
Declaration
public static event EventHandler Exporting
Event Type
Type | Description |
---|---|
System.EventHandler |
ExportPropertyEvent
Event to handle the export of properties.
ExportPropertyEvent += new EventHandler<TransformPropertyEventArgs>(MyProperty.ExportEventHandler);
public static void ExportEventHandler(object sender, TransformPropertyEventArgs e)
{
IContentTransferContext transferContext = sender as IPageTransferContext;
if (transferContext == null // The transfer context should not be null
|| e == null // The event args shuld exists
|| 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;
}
//TODO: Write export transformation code for MyProperty
e.IsHandled = true; // Signal that its handled to all other Export event handlers.
}
Declaration
public static event EventHandler<TransformPropertyEventArgs> ExportPropertyEvent
Event Type
Type | Description |
---|---|
System.EventHandler<TransformPropertyEventArgs> |
FileExported
Occurs after a file has been exported
Declaration
public static event FileExportedEventHandler FileExported
Event Type
Type | Description |
---|---|
FileExportedEventHandler |
FileExporting
Occurs before a file is exported
Declaration
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.