November Happy Hour will be moved to Thursday December 5th.

Exporting content from WinForms/MsBuild with Exporter

Vote:
 

Hi,

I'm wondering how to approach the export process for an EpiServer site when using an MS Build custom task. (I'm testing in a WinForms app)

I have some code that exports in a web page, but when I transfer it to the winforms app, I get an error :"Page transfer has to have a class factory to work with!"

Any suggestions would be appreciated, the code is below...

Thanks,

Andrew

ps: I've copied the web.config of the site into the test app and renamed it app.config

 

 

DataExporter Exporter = new DataExporter(ClassFactoryRegistry.Factory("EPiServer.BaseLibrary.ClassFactory") as DecoratedClassFactory);
// Create an output stream
string exportFile = @"c:\test_dump\99_test_epi_output.dat"; //Path.GetTempFileName();
Exporter.Stream = new FileStream(exportFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
// Add pages to the export package, here alla pages below the startpage
PageReference pr = new PageReference(3);
Exporter.SourceRoots.Add(new ExportSource(pr, ExportSource.RecursiveLevelInfinity));
// Export all pages
Exporter.Export();
// Close the exporter
Exporter.Close();
// Close the out file 
Exporter.Stream.Close();
DataExporter Exporter = new DataExporter(ClassFactoryRegistry.Factory("EPiServer.Enterprise.Transfer.ClassFactory") as DecoratedClassFactory); // Create an output stream string exportFile = @"c:\test_dump\99_test_epi_output.dat"; //Path.GetTempFileName(); Exporter.Stream = new FileStream(exportFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
// Add pages to the export package, here alla pages below the startpage PageReference pr = new PageReference(3); Exporter.SourceRoots.Add(new ExportSource(pr, ExportSource.RecursiveLevelInfinity));
// Export all pages Exporter.Export();
// Close the exporter Exporter.Close();
// Close the out file  Exporter.Stream.Close();

 

 

 

 

#35711
Dec 21, 2009 23:21
Vote:
 

Have you seen this post:

http://labs.episerver.com/en/Blogs/Allan/Dates/2009/8/Codemania-Run-EPiServer-CMS-in-the-Console/

 

#36088
Jan 13, 2010 16:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.