public override List <ApplicationItemProperty> GetApplicationFields(string filePath) { List <ApplicationItemProperty> returnApplicationItemProperties = new List <ApplicationItemProperty>(); List <ApplicationItemProperty> applicationItemProperties = ConfigurationManager.GetInstance().GetApplicationItemProperties(ApplicationTypes.Outlook); Microsoft.Office.Interop.Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mailItem = null; if (filePath == null) { mailItem = (Microsoft.Office.Interop.Outlook.MailItem)outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); } else { mailItem = (Microsoft.Office.Interop.Outlook.MailItem)outlook.CreateItemFromTemplate(filePath); } Microsoft.Office.Interop.Outlook.ItemProperties properties = mailItem.ItemProperties; for (int i = 0; i < properties.Count; i++) { Microsoft.Office.Interop.Outlook.ItemProperty property = properties[i]; ApplicationItemProperty applicationItemProperty = applicationItemProperties.FirstOrDefault(item => item.Name == property.Name); if (applicationItemProperty != null) { ApplicationItemProperty returnApplicationItemProperty = new ApplicationItemProperty( applicationItemProperty.Name, applicationItemProperty.DisplayName, applicationItemProperty.Type); returnApplicationItemProperty.Value = Convert.ChangeType(property.Value, applicationItemProperty.Type); returnApplicationItemProperties.Add(returnApplicationItemProperty); } } #region Writing the xml for field definitions /* * System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter("c:\\fields.xml", Encoding.UTF8); * // start writing! * writer.WriteStartDocument(); * writer.WriteStartElement("Outlook"); * writer.WriteStartElement("MailItem"); * writer.WriteStartElement("ItemProperties"); * System.Xml.XmlDocument document = new System.Xml.XmlDocument(); * System.Xml.XmlNode mainNode = document.CreateNode(System.Xml.XmlNodeType.Element, "MailItem", "Outlook"); * for (int i = 0; i < properties.Count; i++) * { * writer.WriteStartElement("Property"); * writer.WriteAttributeString("Name", properties[i].Name); * writer.WriteAttributeString("DisplayName", properties[i].Name); * writer.WriteAttributeString("Type", properties[i].Type.ToString()); * writer.WriteEndElement(); * } * writer.WriteEndElement(); * writer.WriteEndElement(); * writer.WriteEndElement(); * writer.WriteEndDocument(); * writer.Close(); */ #endregion return(returnApplicationItemProperties); }
protected override List <UploadItem> SetUploadItemFilePath(string sourceFolder, string filePath, UploadItem uploadItem) { if (ConfigurationManager.GetInstance().Configuration.OutlookConfigurations.SaveAsWord&& Path.GetExtension(filePath) == ".msg") { List <UploadItem> additionalItems = new List <UploadItem>(); Microsoft.Office.Interop.Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem)outlook.CreateItemFromTemplate(filePath); string newFileName = filePath.Substring(0, filePath.LastIndexOf('.')) + ".doc"; mailItem.SaveAs(newFileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olDoc); foreach (Microsoft.Office.Interop.Outlook.Attachment attachment in mailItem.Attachments) { string extensionName = String.Empty; string filenameWithoutExtension = String.Empty; string fileName = String.Empty; GetFileNameAndExtension(attachment.FileName, out filenameWithoutExtension, out extensionName); filePath = GetUnuqieFileName(sourceFolder, filenameWithoutExtension, extensionName, out fileName);//keep original name attachment.SaveAsFile(filePath); UploadItem attachmentItem = new UploadItem(); attachmentItem.Folder = uploadItem.Folder; attachmentItem.ContentType = uploadItem.ContentType; attachmentItem.FieldInformations = uploadItem.FieldInformations; attachmentItem.FilePath = filePath; additionalItems.Add(attachmentItem); } uploadItem.FilePath = newFileName; return(additionalItems); } else { base.SetUploadItemFilePath(sourceFolder, filePath, uploadItem); return(null); } }
private void btnSend_Click(object sender, EventArgs e) { try { if (check()) { Microsoft.Office.Interop.Outlook.Application opp = new Microsoft.Office.Interop.Outlook.Application(); if (opp.DefaultProfileName != null) { Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)opp.CreateItem(0); mail.To = "*****@*****.**"; mail.Subject = this.cboSub.Text + " for Kinect Slider: " + txtSub.Text; mail.Body = this.txtBody.Text + System.Environment.NewLine + System.Environment.NewLine + "Kinect Slider" + System.Environment.NewLine + "Sent using " + lblVer.Text; mail.Send(); this.Close(); MessageBox.Show("Thank you for your feedback!", "Kinect Slider", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Couldnt find a Outlook profile. Please send a mail to [email protected]", "Kinect Slider", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "PowerPoint Kinect Slider", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
public void PrintEmailDetails() { oApp = new Outlook.Application(); // Get the MAPI namespace. Outlook.NameSpace oNS = oApp.GetNamespace("mapi"); //Get the Inbox folder. Outlook.MAPIFolder oInbox = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); //Get the Items collection in the Inbox folder. Outlook.Items oItems = oInbox.Items; //Output some common properties. for (int i = oItems.Count; i > oItems.Count - 5; i--) { Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oItems[i]; Console.WriteLine("Subject: {0}", oMsg.Subject); Console.WriteLine("From: {0} <{1}>", oMsg.SenderName, oMsg.SenderEmailAddress); Console.WriteLine("To: {0}", oMsg.To); Console.WriteLine("ReceivedTime: {0}", oMsg.ReceivedTime); Console.WriteLine("Links: {0}", oMsg.Links); int AttachCnt = oMsg.Attachments.Count; Console.WriteLine("Attachments: " + AttachCnt.ToString()); if (AttachCnt > 0) { for (int j = 1; j <= AttachCnt; j++) { Console.WriteLine(j.ToString() + "-" + oMsg.Attachments[j].DisplayName); } } Console.WriteLine("Size: {0} KB", oMsg.Size / 1024); Console.WriteLine("---------------------------------"); } }
private void Feedback() { try { if (check()) { Microsoft.Office.Interop.Outlook.Application opp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)opp.CreateItem(0); mail.To = "*****@*****.**"; mail.Subject = this.cboSub.Text + ": " + txtSub.Text; mail.Body = this.txtBody.Text + System.Environment.NewLine + System.Environment.NewLine + "Sent using " + lblVer.Text; mail.Send(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "One Click Functions", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void items_ItemAdd(object Item) { Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)Item; //var mail = (Outlook.OlItemType.olMailItem)Item; string subject = mail.Subject; //mail.BodyFormat = Outlook.OlBodyFormat.olFormatPlain; // MailItem에서 Body를 못 가져옵니다. // Office 2016 pro plus의 오류. ㅜㅡ; **** string body = mail.Body; string realBody = string.Empty; realBody = ai.GetRealBody(body); string strTemp = ai.GetMailIent(subject, realBody); if (!String.IsNullOrEmpty(strTemp)) { mail.FlagStatus = Outlook.OlFlagStatus.olFlagMarked; mail.Importance = Outlook.OlImportance.olImportanceHigh; mail.Categories = strTemp; mail.Save(); // 여기서 좀 더 확장가능 // Reqeust: To-do에 등록 // Meeting Request: 일정에 등록 또는 "일정확정" 으로 to-do에 등록. // Reply: } }
public void ConfigureEmailItem(ref Microsoft.Office.Interop.Outlook.MailItem mailItem) { mailItem.To = _ToEmailAddresses.Aggregate((m, n) => m + ";" + n); mailItem.CC = _CCEmailAddresses.Aggregate((m, n) => m + ";" + n); foreach (string attachment in _SiteAttachmentFilePaths.Concat(_GlobalAttachmentFilePaths)) { mailItem.Attachments.Add(attachment); } }
public override void GetApplicationDragDropInformation(System.Windows.IDataObject data, out string[] filenames, out MemoryStream[] filestreams) { List <string> _fileNames = new List <string>(); List <MemoryStream> _filestreams = new List <MemoryStream>(); string sourceFolder = ConfigurationManager.GetInstance().CreateATempFolder(); Microsoft.Office.Interop.Outlook.Application application = Application as Microsoft.Office.Interop.Outlook.Application; for (int i = 1; i <= application.ActiveExplorer().Selection.Count; i++) { Object temp = application.ActiveExplorer().Selection[i]; if (temp is Microsoft.Office.Interop.Outlook.MailItem) { Microsoft.Office.Interop.Outlook.MailItem mailitem = (temp as Microsoft.Office.Interop.Outlook.MailItem); string fileName = mailitem.Subject + ".msg"; string invalid = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars()); foreach (char c in invalid) { fileName = fileName.Replace(c.ToString(), ""); } string filePath = sourceFolder + "\\" + fileName; mailitem.SaveAs(filePath); MemoryStream ms = new MemoryStream(); using (FileStream fs = File.OpenRead(filePath)) { fs.CopyTo(ms); } _fileNames.Add(fileName); _filestreams.Add(ms); } } filenames = _fileNames.ToArray(); filestreams = _filestreams.ToArray(); /* * //wrap standard IDataObject in OutlookDataObject * OutlookDataObject dataObject = new OutlookDataObject(data); * * try * { * //get the names and data streams of the files dropped * filenames = (string[])dataObject.GetData("FileGroupDescriptorW"); * filestreams = (MemoryStream[])dataObject.GetData("FileContents"); * } * catch (Exception ex) * { * string subject = ((string)dataObject.GetData("Text")).Split(new char[]{'\n'})[1].Split(new char[]{'\t'})[1]; * filenames = new string[]{subject}; * filestreams = new MemoryStream[] { (MemoryStream)dataObject.GetData("Object Descriptor") }; * } */ }
private void CreateMailItem(String Subject) { Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); mailItem.Subject = Subject + " " + currentDate.ToString("dd MMMM yyyy") + " - " + currentDate.ToString("hh:mm:ss tt"); mailItem.To = strTOMAIL; mailItem.Body = "Hi\n\nPlease find my today's " + Subject + " " + currentDate.ToString("dd MMMM yyyy") + " - " + currentDate.ToString("hh:mm:ss tt") + "." + "\n\nSystem Details:\nUser Name: " + user_name + "\nHOSTNAME: " + hostname + "\nIP Address:" + IP_Address + "\nMAC Address: " + MAC_Address + "\nDOMAIN: " + domain_name + "\n\nThis is autogenerated email sent by Time Management System.\n\nThanks & Regards\n" + user_name; //mailItem.Attachments.Add(attachment_path); //attachment_path is a string holding path of the attachment mailItem.Importance = Outlook.OlImportance.olImportanceHigh; mailItem.Display(false); mailItem.Send(); }
/// <summary> /// Default constructor /// </summary> /// <param name="newMail">Mail item</param> /// <param name="interval">Time in ms to keep the alert on</param> public NewMailAlert(Microsoft.Office.Interop.Outlook.MailItem newMail, int interval) { InitializeComponent(); this.LoadFolders(); this.Email = newMail; // Assign it to open or flag later this.lnkSender.Text = newMail.Sender.Name; this.lnkSubject.Text = newMail.Subject; this.txtBody.Text = newMail.Body; this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width - 10; this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height - 10; this.timer = new Timer(); timer.Interval = interval; timer.Tick += timer_Tick; timer.Start(); }
private String sendEmail(String subject, String body, String[] receivers) { try { //if Outlook is not open start it and wait Process[] pName = Process.GetProcessesByName("OUTLOOK"); if (pName.Length == 0) { // Open Outlook anew. System.Diagnostics.Process.Start("OUTLOOK.EXE"); System.Threading.Thread.Sleep(2000); } //**** Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem)app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); //The email receiver //recipients Microsoft.Office.Interop.Outlook.Recipients recipients = mailItem.Recipients as Microsoft.Office.Interop.Outlook.Recipients; foreach (var email in receivers) { recipients.Add(email); } mailItem.Subject = subject; mailItem.Body = body; mailItem.Send(); return("sent"); } catch (System.Runtime.InteropServices.COMException ex) { if (ex.ErrorCode == -2147417846) { return("This Programm Use Outlock Service To Send Your Email, You Need To Execute Outlock First Than Send Your Email."); } else { //return "Error, Email was Not sent"; return("sent"); } } }
//public string DailyMediaReportSMTP(DateTime todaysdate) //{ // try // { // string fileName = Server.MapPath("../") + "Report\\" + "DailyMediaReport -11-20-2018.pdf"; // //fileName = "\\dpw-cisweb-tst\\E$\\Inetpub\\WWWRoot\\Communications\\" + "Report\\" + fileName; // OpenOutLookSMTP(fileName);//DailyMediaReport -11-20-2018 // return "true"; // } // catch (Exception ex) // { // var resultPdfReport = new { Valid = false, Message = ex.InnerException }; // var exeception = ex.Message; // // andy // //return false; // return exeception; // } // finally // { // //check stream length or if stream not close, close stream // //Same here, use report.Close(); // } //} //Old method-HP public void OpenOutLook(string fileName) { Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); //Verify it haritha //Globals.ThisAddIn.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem) //using oMsg{ //oMsg.To = "Daily Media Report Contacts"; oMsg.To = "*****@*****.**"; oMsg.Subject = "Department of Public Works Daily Media Log for " + System.DateTime.Now.ToShortDateString() + "."; oMsg.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML; oMsg.HTMLBody = "The attached log sheet reflects media contact information as of 2:30 p.m. today. Information received" + " afterwards will be listed on next day\'s log with date noted."; //oMsg.HTMLBody = // "The attached log sheet reflects media contact information as of " + System.DateTime.Now.ToShortTimeString() + " today. Information received" + // " afterwards will be listed on next day\'s log with date noted."; oMsg.Attachments.Add(fileName, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing); oMsg.Display(oMsg); // } }
public void SendEmail() { //MessageBox.Show("In Send Email"); Microsoft.Office.Interop.Outlook.Application app = null; Microsoft.Office.Interop.Outlook.MailItem mailItem = null; try { //var emailTo = "*****@*****.**"; //mailItem.To = emailTo; app = new Outlook.Application(); mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); mailItem.To = ToBox.Text.ToString(); mailItem.Subject = SubjectBox.Text.ToString(); mailItem.Body = BodyBox.Text.ToString(); List <string> CC = CCBox.Text.Split(',').ToList(); Outlook.Recipients recips = (Outlook.Recipients)mailItem.Recipients; foreach (string email in CC) { Outlook.Recipient recip = (Outlook.Recipient)recips.Add(email); recip.Type = (int)Outlook.OlMailRecipientType.olCC; } string log = "Email sent to " + mailItem.To.ToString(); ((Outlook._MailItem)mailItem).Send(); MessageBox.Show(log); } finally { if (app != null) { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(app); } if (mailItem != null) { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(mailItem); } this.Close(); } }
//отправляем каждому необходимые работы void SendEmails() { string prform_path; for (int i = 0; i < peers.Count; i++) { for (int j = 0; j < peers[i].new_guids.Count; j++) { prform_path = session.Folder_path + @"\Review " + peers[i].guids_ID[j] + ".xlsm"; File.Copy(@"..\..\..\PATemplate_Example.xlsm", prform_path); Excel.Application xlApp = new Excel.Application(); Excel.Workbook Book = xlApp.Workbooks.Open(prform_path); Excel.Worksheet Sheet = Book.Sheets[1]; Sheet.Cells[1, 2] = peers[i].prform_IDs[j]; Book.Close(true); xlApp.Quit(); Book = null; Sheet = null; Microsoft.Office.Interop.Outlook._Application _app = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)_app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); mail.To = peers[i].email; mail.Subject = peers[i].prform_IDs[j] + " review for " + session.TaskTitle + peers[i].new_guids[j]; mail.Body = "Hello!" + "\n" + "\t" + "Please see attached files." + "\n" + "Reply to this message with attached complete PR form (" + peers[i].prform_IDs[j] + ".xlsm) only." + "\n" + "Deadline for reviews is " + session.Review_End + "." + "\n\t" + "Truly yours, Peer Review Robot."; mail.Attachments.Add(prform_path); mail.Attachments.Add(Directory.GetFiles(session.Folder_path, $"{peers[i].new_guids[j]}*")[0]); mail.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceNormal; Outlook.Account account = GetOutlookAccount(_app, session.OutlookAccount); mail.SendUsingAccount = account; mail.Send(); _app.Quit(); _app = null; mail = null; File.Delete(prform_path); } } }
public static void ReadOutlook() { Outlook._Application olApp = new Outlook.ApplicationClass(); Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); olNS.Logon("@OutlookEmail", "@OutlookPassword", false, false); Outlook.MAPIFolder oFolder = olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); TodayDate = DateTime.Now.ToString("MM/dd/yyyy"); Outlook.Items oItems = oFolder.Items.Restrict("[ReceivedTime] >= '" + TodayDate + "'"); //Outlook.Items oItems = oFolder.Items.Restrict("[UnRead] = true"); for (int i = 1; i <= oItems.Count; i++) { Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oItems[i]; MailSubject = oMsg.Subject.ToString(); MailBody = System.Web.HttpUtility.JavaScriptStringEncode(oMsg.Body); if (MailSubject.StartsWith("RE:") || MailSubject.StartsWith("FW:") || MailSubject.StartsWith("Re:") || MailSubject.StartsWith("Fw:") || MailSubject.StartsWith("Fwd:")) { // Do not fetch mail with contains word above (reply and forward type) } else { EmailCount++; NewEmailList.Add(MailSubject); Console.WriteLine(MailSubject + MailBody); CreatJiraIssue(MailSubject, MailBody); } } ListName = string.Join("\n", NewEmailList.ToArray()); Console.WriteLine(EmailCount); Microsoft.Office.Interop.Outlook.MailItem oMsgSend = (Outlook.MailItem)olApp.CreateItem(Outlook.OlItemType.olMailItem); oMsgSend.To = "######Recieved_Email######"; oMsgSend.To = "######Sender_Email######"; oMsgSend.Subject = "Summary Auto Email Fetching " + TodayDate; oMsgSend.Body = "All New Email count: " + EmailCount + "\n\nFetching complete: " + EmailCount + "\n\nList Email names: \n\n" + ListName; oMsgSend.Save(); oMsgSend.Send(); }
private void Frnd() { try { if (check()) { Microsoft.Office.Interop.Outlook.Application opp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)opp.CreateItem(0); mail.To = txtTO.Text; mail.Subject = txtSub.Text; mail.Body = txtBody.Text; mail.Send(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "One Click Functions", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void SelectionChangeEvent() { replyfired = false; //Hide Template section Outlook.Explorer explorer = Globals.ThisAddIn.Application.Explorers.Application.ActiveExplorer(); var inlineResponse = explorer.ActiveInlineResponse; if (inlineResponse == null) { ShowTemplateSection = Visibility.Collapsed; } else { ShowTemplateSection = Visibility.Visible; } if (Globals.ThisAddIn.Application.ActiveExplorer().Selection.Count > 0) { Object selObject = Globals.ThisAddIn.Application.ActiveExplorer().Selection[1]; if (selObject is Microsoft.Office.Interop.Outlook.MailItem) { Outlook.MailItem currSel = (Outlook.MailItem)selObject; if (SelectedMailItem != null) { foreach (Microsoft.Office.Tools.CustomTaskPane pane in Globals.ThisAddIn.CustomTaskPanes) { if (pane.Title == "MailTangy UserSpecific") { pane.Visible = true; } if (pane.Title == "MailTangy Cases") { pane.Visible = false; } if (pane.Title == "Login | Salesforce") { Globals.ThisAddIn.CustomTaskPanes.Remove(pane); } } try { if (SelectedMailItem.EntryID != currSel.EntryID) { resetUI(); SelectedMailItem = selObject as Microsoft.Office.Interop.Outlook.MailItem; ((Outlook.ItemEvents_10_Event)SelectedMailItem).Reply += new Outlook.ItemEvents_10_ReplyEventHandler(MailReplyEventHandler); ((Outlook.ItemEvents_10_Event)SelectedMailItem).ReplyAll += new Outlook.ItemEvents_10_ReplyAllEventHandler(MailReplyEventHandler); ((Outlook.ItemEvents_10_Event)SelectedMailItem).Forward += new Outlook.ItemEvents_10_ForwardEventHandler(MailReplyEventHandler); //Outlook.Recipient rec = Globals.ThisAddIn.Application.GetNamespace("MAPI").Session.CurrentUser; string loggedInUser = Globals.ThisAddIn.myCredentials.EmailID; //Outlook.AddressEntry AddEntry = rec.AddressEntry; //if (AddEntry.Type == "EX") //{ // loggedInUser = rec.AddressEntry.GetExchangeUser().PrimarySmtpAddress; //} //else //{ // loggedInUser = rec.AddressEntry.Address; //} string SenderEmailID = SelectedMailItem.SenderEmailAddress; CallGmailProfileAPI(SenderEmailID); CallSummerizedServletAPI(SenderEmailID, SelectedMailItem.Subject, SelectedMailItem.Body); GetTemplates(SenderEmailID); if (LeadOrCase == "LEAD") { CallLeadCaseDataBasedOnEmail(SenderEmailID); } if (LeadOrCase == "CASE") { DisplayCaseBasedOnEmail(loggedInUser, SenderEmailID, SelectedMailItem.Subject); } } } catch (System.Exception) { //throw; } } else { SelectedMailItem = selObject as Microsoft.Office.Interop.Outlook.MailItem; ((Outlook.ItemEvents_10_Event)SelectedMailItem).Reply += new Outlook.ItemEvents_10_ReplyEventHandler(MailReplyEventHandler); ((Outlook.ItemEvents_10_Event)SelectedMailItem).ReplyAll += new Outlook.ItemEvents_10_ReplyAllEventHandler(MailReplyEventHandler); ((Outlook.ItemEvents_10_Event)SelectedMailItem).Forward += new Outlook.ItemEvents_10_ForwardEventHandler(MailReplyEventHandler); } } } }
public EmailTestONe() { InitializeComponent(); eMail = (Outlook.MailItem) this.oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); }