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

DataExporter

Vote:
 

This example is taken from the SDK. And the only file it make is file containing 0kb. Anyone know why?

// Create a new exporter  DataExporter Exporter = new DataExporter();  // Create an output stream string exportFile = Path.GetTempFileName(); Exporter.Stream = new FileStream(exportFile, FileMode.Create, FileAccess.Write, FileShare.None);  // Add pages to the export package, here alla pages below the startpage Exporter.SourceRoots.Add(new ExportSource(PageReference.StartPage,      ExportSource.RecursiveLevelInfinity));  // Export all pages Exporter.Export();  // Close the exporter Exporter.Close();  // Close the out file  Exporter.Stream.Close();
#19445
Apr 11, 2008 17:39
Vote:
 

Hi Svein!

The reason is probably an exception during export. The Export method eats all exceptions and if you have any issues you will se then in Exporter.Log.Errors and Exporter.Log.Warnings.

Regards,
Fredrik Haglund - http://blog.fredrikhaglund.se

#19475
Apr 13, 2008 22:41
Vote:
 

Hi!

I guess the SDK example is incorrect. Possible values for FileAccess are Read and ReadWrite and for FileMode CreateNew and Append.

Exporter.Stream = new FileStream(exportFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);

Regards,

Marthin Freij
Konstruktor Sweden AB
http://www.konstruktor.se/

#24296
Sep 30, 2008 15:51
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.