web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Sending a MS CRM report in body of Email

(0) ShareShare
ReportReport
Posted on by 461

HI,

I would like to send my custom report  as Email body  (not the attachment of email)

Please help me ,

Thanks in Advance

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    jlattimer Profile Picture
    24,562 on at

    Ideally you would use a plugin or custom workflow to generate the email and produce the content inside the email body especially if you need to include data from child records in a relationship. 

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi Shekar,

    You can do it with custom coding..

    You can render SSRS report into different formats like PDF, MHTML, CSV, Word etc.

    To use it into Email body you need to render report into MHTML format.

    When you render to MHTML format, it is give you Byte array, you can get report output in HTML from byte array by using

    byte[] reportDetails = Report rendered output;
    
    System.Text.UTF8Encoding reportInHtml = new UTF8Encoding();
    
    string ReportRenderedMHTML = reportInHtml.GetString(reportDetails);

    Then just assign this ReportRenderedMHTML  to Email description.

    Email email=new Email();
    
    email.Description= ReportRenderedMHTML ;

    Here are more details on HTML rendering

    msdn.microsoft.com/.../dd255269.aspx;MSPPError=-2147217396

    stackoverflow.com/.../render-ssrs-2008-report-in-web-page-without-report-viewer

    Sometime when you add this report MHTML to email body.. In outlook format is not showing properly.. in web browser its shows correct..

    In this case you might use MHTML to HTML parse and add HTML output to email body.

    prndl.us/mhtml-html-decoding-c-sharp

    github.com/.../MHTML-to-HTML-Decoding-in-C-Sharp

    Hope this will help..

  • Community Member Profile Picture
    on at

    Any ideas if the report has charts (that render as images) and the email needs to be open in Outlook.

    How can we create MIME attachments to a CRM Email that can be referenced from the email body with a cid???

  • Community Member Profile Picture
    on at

    Any ideas if the report has charts (that render as images) and the email needs to be open in Outlook.

    Outlook definitively does not support embedded images in email messages. So, images need to be added as attachments. 

    How can we create MIME attachments to a CRM Email that can be referenced from the email body with a cid?

    I didn't see in the activitymimeattachment entity an option to create or associate a cid.

  • Bilal Ahmed Profile Picture
    270 on at

    Thank You Mahadeo Matre,

    The solution works perfectly for me, you are life saver for me, i was looking for the solution for days and going no where.

     

    Thanks Again Mate 

     

  • Community Member Profile Picture
    on at

    Hi Mahadeo,

    Can you please help to convert MHTML to HTML from JavaScript.

    I have requirement in which i have to place ssrs report content in mail body.

    Regards,

    kamran

  • Mridula Profile Picture
    275 on at

    Hi,

    I am trying the same approach with the word document template. Retrieved the word annotation and converting its documentbody contents to bytes and then to string as shown below.

    byte[] file = Convert.FromBase64String(_NotesAttachment.Attributes["documentbody"].ToString());

    System.Text.UTF8Encoding reportInHtml = new UTF8Encoding();

    string content = reportInHtml.GetString(file);

    but , I am facing this error "The field 'description' contains one or more invalid characters".

    Anyone faced this error?

    Thanks,

    Mridula

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans