Attach a Valentina Report On Web to Email?

Hi,

I have followed the example on the web on how to create a PDF Report and download it.

[code]
dim rep1 as VReport
rep1 = vlProject.MakeNewReport( “CEUCertificateManu”, Session.sesWebDB.gsWConnectionStr, lsSql)

dim spdfData as String = rep1.PrintToBuffer(EVReportPrintType.kToPDF, 1)

rep1.PrintToDisk( lfiSavePDF, EVReportPrintType.kToPDF)

mPDF = New WebFile
mPDF.MIMEType = “application/pdf”
mPDF.Filename = “report.pdf”
mPDF.ForceDownload = False
mPDF.Data = spdfData

vlProject.Close

ShowURL(mPDF.URL, True) [/code]

mPDF is a Property of the form

Then in another Method:

  dim file as emailAttachment
  
  file = new emailAttachment
  file.LoadFromFile cnt1.mPDF.Download <————————-No matter what I Use I get an error.  Parameter not compatable.
  Msg.Attachments.Append file

No matter what property of mPDF I use I get an error.

Thanks

Rich

EmailAttachment.Append expects a FolderItem, not a WebFile.

You may be able to just assign the spdfData to the EmailAttachment.Data property, and set the MIMEType also.

If that doesn’t work, you could try creating a new FolderItem (maybe use GetTemporaryFolderItem), open a BinaryStream on it and write the spdfData to it, then close the BinaryStream and attach the FolderItem as you’re doing above.