SAP Knowledge Base Article - Public

1295243 - How to export to MAPI using CRYSTALREPORT .NET SDK

Symptom

How to export to MAPI using CRYSTALREPORT .NET SDK

Reproducing the Issue

Environment information

·        Windows 2003 (x86) Server SP1

·        Crystal Report XI, XI R2, 2008 Developer

·        .NET Framework 1.1, 2.0

·        C#

Resolution

Sample:
//Reference to Assemblies
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms; 
//ReportDocument Declaration
ReportDocument crreportdocument;
//Create an Instance of the ExportOptions
ExportOptions crexportoptions = new ExportOptions(); 
//Exchange mail settings Account
MicrosoftMailDestinationOptions crexchange = new MicrosoftMailDestinationOptions();
crexchange.MailToList = "destination email address";
crexchange.MailSubject = "this is a test";
crexchange.MailMessage = "This is a test"; 
// Create an instance of the ReportDocument
crreportdocument = new ReportDocument();
// Load the Report
crreportdocument.Load(@"C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\Samples\en\Reports\General Business\Employee Sales.rpt", OpenReportMethod.OpenReportByTempCopy);
// Setting the export destination Option and Export Format Type
crexportoptions = crreportdocument.ExportOptions; 
crexportoptions.ExportDestinationOptions = crexchange;
crexportoptions.ExportFormatType = ExportFormatType.CrystalReport; 
crexportoptions.ExportDestinationType = ExportDestinationType.MicrosoftMail;
// Export to MAPI
crreportdocument.Export(crexportoptions); 
For more information about the CrystalReport .NET SDK, refer to the devLibrary: http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_apiRef_12_en.chm

See Also

SAP Note 1326487 - How to export a Crystal Report to MAPI destination in Visual Studio .NET

Keywords

How to export to MAPI using CRYSTALREPORT .NET SDK, export to MAPI, CRYSTALREPORT .NET , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio