hi below is my javascript code for opening default outlook.
<script language="javascript" type="text/javascript">
function SendAttach() {
var theApp //Reference to Outlook.Application
var theMailItem //Outlook.mailItem
var attach3 = '<%= Session["MyFilePath"].ToString() %>'
var recipient
var subject = "Report Document"
var msg = "Please Find Attached File \n\n" + "Thanks & Regards \n" + '<%= Session["USER"].ToString() %>'
try {
var theApp = new ActiveXObject("Outlook.Application");
var objNS = theApp.GetNameSpace('MAPI');
var theMailItem = theApp.CreateItem(0) // value 0 = MailItem
theMailItem.Subject = (subject);
theMailItem.Body = (msg);
theMailItem.Attachments.add(attach3);
theMailItem.display();
} catch (err) {
alert("The following may have cause this error: \n" + "1. The Outlook express 2003 is not installed on the machine.\n" + "2. The msoutl.olb is not availabe at the location " + "C:\\Program Files\\Microsoft Office\\OFFICE11\\msoutl.old on client's machine " + "due to bad installation of the office 2003." + "Re-Install office2003 with default settings.\n" + "3. The Initialize and Scripts ActiveX controls not marked as safe is not set to enable.")
}
}
</script>
in this <%= Session["MyFilePath"].ToString() %>
is passed by server side code.
MyFilePath
is path of my file which i am attaching as an attachment in outlook.
this working fine on server side but when i run on client side this file path is not attaching attachment which is on server side.
below is my server side code.
reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
reportDocument.Load(Server.MapPath("~/Boreports/Print_Lpo.rpt"));
Session["Rpt_Name"] = "Local_Purchase_Order_Rpt";
string Fname = "C://" + Session["Rpt_Name"].ToString() + ".pdf";
paramField = new ParameterField();
paramField.Name = "@LPONO";
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = Session["LPO_NO"].ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
reportDocument.SetParameterValue("@LPONO", paramDiscreteValue);
paramField = new ParameterField();
paramField.Name = "@REC_TYPE";
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = Session["ReportType1"].ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
reportDocument.SetParameterValue("@REC_TYPE", paramDiscreteValue);
// Session["param"] = paramFields;
//Session["reportdoc"] = "~/Boreports/Print_Lpo.rpt";
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, Fname);
Session["MyFilePath"] = Fname;
how i will get my serverside exported file on client machine??