none
Show Outlook New Email Window report as attachment Which deployed in IIS RRS feed

  • Question

  • Hi all,

    I am using ssrs (.rdl) files and showing them on report viewer, this is working fine.

    now i want to open client mail window(Outlook) with report(mentioned above) as attachment.

    in visual studio i did it with following code lines. but when i deploy it on IIS it showing Error which is shown below please guide me is there any solution to run this code in IIS, or any other alternative...

    Code :            

          Warning[] warnings;

          string[] streamids;

          string mimeType, encoding, extension;       MemoryStream memoryStream = new MemoryStream();       Outlook.Application oApp = new Outlook.Application();

    Outlook.MailItem oMailItem = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);//Here Is Error  

    byte[] bytes = reportViewer.LocalReport.Render(attatchmentFileFormat, null, out mimeType, out encoding, out extension, ut streamids, out warnings); memoryStream = new MemoryStream(bytes);

     memoryStream.Seek(0, SeekOrigin.Begin);  SaveRenderReportAsFile(memoryStream, attatchmentFileFormatWithExtension, AttatchmentFileTempPath);

    Error:

    at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at IssueTrackerRWC.EmailService.ShowOutlookPopup(Label& lblPath, ReportViewer reportViewer, String attatchmentFileFormatWithExtension, String attatchmentFileFormat, String AttatchmentFileTempPath) in C:\Users\shjain\Desktop\IssueTrackerRWC\IssueTrackerRWC\ReportUtils\EmailService.cs:line 100 at SSRSWeb.Report.btn_Click(Object sender, EventArgs e) in C:\Users\shjain\Desktop\IssueTrackerRWC\IssueTrackerRWC\Report.aspx.cs:line 304

    Please help me on this…..

    Thanks in advance.




    Tuesday, February 12, 2013 7:14 AM

Answers

  • not possible if you want to encompass all possible configurations (and web browsers). You can use mailto: protocol to display mail window from default mail program on user machine but it will be without your attachment. If you were willing to stick only with IE you could write activex for this functionality or if you were willing to handle only outlook you could create msg file with attachment on the server and send that msg to open on client machine. Or you could ask for user's email and send him via email created mail. But your scenario taken as verbatim is not possible.
    Wednesday, February 13, 2013 8:22 AM
  • MS does not support any automation of Office applications from any service or unattended usage. That especially goes for Outlook. See http://support.microsoft.com/kb/257757

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Shashank_MCA" <=?utf-8?B?U2hhc2hhbmtfTUNB?=> wrote in message news:b817552d-cb85-4f38-ac94-80bf967434f4...

    Thanks DamianD for this information,

    can you please give me any reference link where we can verify following things,

    1.automation of office apps from inside IIS is not supported.

    2. In my scenario it is not possible.

    So that i can satisfy my client that for this reason it is not possible.

    Please send me if you have otherwise ignore this reply...

    Thanks for help if any workaround related this you find on this let me know please....

    Happy coding :)



    Ken Slovak MVP - Outlook
    Monday, February 18, 2013 6:37 PM

All replies

  • automation of office apps from inside IIS is not supported. If you want to send your report as attachments from IIS, please consider using EWS (if you are using exchange), or other appropriate client, depending on your protocol.
    Tuesday, February 12, 2013 8:05 AM
  • Thanks DamianD,

    In my case i want to open an email window of client machine with report as attachment and on client machine may have exchange,Outlook any version or do not have installed outlook.

    so i need solution for that please guide me is it possible? if yes please help me on this.... if no then also help me... for any better alternative...

    I am using VS 2010 Web application.

    Deployed on IIS 7.0.

    Testing by using Outlook 2010.

    Thanks again for replying...

    it is very urgent for me........

    Happy Coding... :)

    Wednesday, February 13, 2013 4:29 AM
  • if client may not have outlook installed then what do you want to send him? mail in what format? every mail client uses its own format for storing mails. Anyway, you can send him your generated report, like this: http://stackoverflow.com/questions/1072814/c-sharp-asp-net-write-file-to-client
    Wednesday, February 13, 2013 5:02 AM
  • Thanks Demian,

    You are correct but i think you may misunderstood the requirement..

    let me clear the scenario again...

    i used a report viewer on a .aspx page which show a .rdl file on the same page i have a button,

    when i click on this button I need to open a new email window of Client Machine's configured mail the only thing this window contain my report as an attachment. here user of my product can enter information in this window like From,CC,Subject and send it. then he again come to my page.

    so for this requirement i developed web application which is working fine on VS2010 envirment but as i deploy it on IIS 7 it shows error.

    So please guide me for this...

    Wednesday, February 13, 2013 7:27 AM
  • not possible if you want to encompass all possible configurations (and web browsers). You can use mailto: protocol to display mail window from default mail program on user machine but it will be without your attachment. If you were willing to stick only with IE you could write activex for this functionality or if you were willing to handle only outlook you could create msg file with attachment on the server and send that msg to open on client machine. Or you could ask for user's email and send him via email created mail. But your scenario taken as verbatim is not possible.
    Wednesday, February 13, 2013 8:22 AM
  • Thanks DamianD for this information,

    can you please give me any reference link where we can verify following things,

    1.automation of office apps from inside IIS is not supported.

    2. In my scenario it is not possible.

    So that i can satisfy my client that for this reason it is not possible.

    Please send me if you have otherwise ignore this reply...

    Thanks for help if any workaround related this you find on this let me know please....

    Happy coding :)


    Wednesday, February 13, 2013 9:35 AM
  • MS does not support any automation of Office applications from any service or unattended usage. That especially goes for Outlook. See http://support.microsoft.com/kb/257757

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Shashank_MCA" <=?utf-8?B?U2hhc2hhbmtfTUNB?=> wrote in message news:b817552d-cb85-4f38-ac94-80bf967434f4...

    Thanks DamianD for this information,

    can you please give me any reference link where we can verify following things,

    1.automation of office apps from inside IIS is not supported.

    2. In my scenario it is not possible.

    So that i can satisfy my client that for this reason it is not possible.

    Please send me if you have otherwise ignore this reply...

    Thanks for help if any workaround related this you find on this let me know please....

    Happy coding :)



    Ken Slovak MVP - Outlook
    Monday, February 18, 2013 6:37 PM