I am using Crystal Reports bundled with VS2008.
A client asked me to add a feature to e-mail the report he currently sees in the viewer. I looked around the properties of the viewer and saw nothing that does that.
So I have added a plain old button to my viewer form and pasted this code I found googling (I am not sure it is related to this version of CR):
Private Sub btnEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmail.Click
Dim pdfOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
Dim mailOpts As MicrosoftMailDestinationOptions = ExportOptions.CreateMicrosoftMailDestinationOptions()
Dim exportOpts As ExportOptions = New ExportOptions
pdfOpts.UsePageRange = False
exportOpts.ExportFormatOptions = pdfOpts
exportOpts.ExportDestinationOptions = mailOpts
exportOpts.ExportDestinationType = ExportDestinationType.MicrosoftMail
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
With DirectCast(Me.Viewer.ReportSource, CrystalDecisions.CrystalReports.Engine.ReportDocument)
With this code, an "InvalidArgumentException" is raised on the .Export line. The Message is "Invalid export options".
Is this the correct way to e-mail the report? Is there another method?