Automated Utility to email the Report

Last post 11-07-2009 3:43 AM by Amipatel1986. 3 replies.

Sort Posts:

  • Crying [:'(] Automated Utility to email the Report

    10-26-2009, 4:27 AM
    • Member
      323 point Member
    • Amipatel1986
    • Member since 04-10-2008, 7:59 AM
    • Ahmedabad, India
    • Posts 99

    I want to create automated utility to email the report.

    For achieving this utility I have used SSRS (SQL server reporting services). I have created .rdl report and use data driven subscription to mail this report automatically.

    I want to use custom subject (with some database value) and body in mail. This can be done using only Data driven subscription in SSRS.

    But my problem is that on our client machine there is Standard Edition SQL server and Data-driven subscriptions are not supported in the Standard edition.

    So is there any work around of this?

    FYI: I don't want to upgrade Sql server edition on Client machine.

    Please help me.


    Thanks.

     

     

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Automated Utility to email the Report

    10-28-2009, 11:34 PM

    Hi,

    From your description, you want to create a custom application to email the SSRS report, but the Standard Edition don't support Data-Driven Subscriptions.

    If so, we can export the SSRS report into PDF file or other forms, then create a ASP.NET web application to send email which attachs the aboved PDF file.

    For more information about "Sending Email with ASP.NET", please refer to

    http://www.aspheute.com/english/20000918.asp

     

    As for how to export the SSRS report into PDF without showing it in the web page, we can use the following code.

            Microsoft.Reporting.WebForms.ReportViewer rview = new Microsoft.Reporting.WebForms.ReportViewer();     

            rview.ServerReport.ReportServerUrl = new Uri("http://localhost:8080/ReportServer");

            rview.ServerReport.ReportPath = "/Adventure Works/Report1";

            string mimeType, encoding, extension;

            string[] streamids;Microsoft.Reporting.WebForms.Warning[] warnings;

            string format = "PDF";    

            byte[] bytes = rview.ServerReport.Render(format, "", out mimeType, out encoding, out extension, out streamids, out warnings);

            //save the pdf byte to the folder

            FileStream fs = new FileStream(Server.MapPath("report.pdf"), FileMode.Open);

            byte[] data = new byte[fs.Length];

            fs.Write(bytes, 0, bytes.Length);

            fs.Close();

     

     

    Please feel free to let me know if I’ve misunderstood anything.

     

    Sincerely,
    Zong-Qing Li
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Automated Utility to email the Report

    10-29-2009, 12:05 AM
    • Member
      323 point Member
    • Amipatel1986
    • Member since 04-10-2008, 7:59 AM
    • Ahmedabad, India
    • Posts 99

    Hi Zong-Qing Li - MSFT

    Thanks for your reply.

    But I don't want to send email with .pdf attachment. I want to send report as mail body.

    Also I want to send automated email every night. So How can I shedule it? Is there any way to create custom datadriven subscription in standard edition of sql server?

    Thanks.




    Remember to click "Mark as Answer" on the post that helps U
  • Re: Automated Utility to email the Report

    11-07-2009, 3:43 AM
    • Member
      323 point Member
    • Amipatel1986
    • Member since 04-10-2008, 7:59 AM
    • Ahmedabad, India
    • Posts 99

    Please Help me.

    Remember to click "Mark as Answer" on the post that helps U
Page 1 of 1 (4 items)