/// <summary> /// Creates a reply, pre-addressed to the original sender or all original recipients, from the original message /// </summary> /// <param name="replyAll" - replies to all original recipients if true; only to the original sender if false></param> /// <returns>A MailItem object that represents the reply</returns> public MailItem Reply(bool replyAll) { if (replyAll) { return(new MailItem(_mailitem.ReplyAll())); } else { return(new MailItem(_mailitem.Reply())); } }
public IMailItem Reply(bool replyAll) { if (replyAll) { return(new MailItemProviderOM(_mailItem.ReplyAll())); } else { return(new MailItemProviderOM(_mailItem.Reply())); } }
public void HandleReplyWithTemplate(JiraTemplate jiraTemplate) { if (dataModel.JiraEmail == null || dataModel.JiraEmail.Length < 1) { MessageBox.Show("Invalid Jira Email.\nPlease update email address in Jira Tab.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (jiraTemplate == null) { // fallback to default jiraTemplate = dataModel.DefaultTemplate; } try { Outlook._Explorer exp = Globals.ThisAddIn.Application.ActiveExplorer(); if (exp != null && exp.Selection != null && exp.Selection.Count > 0) { foreach (Object item in exp.Selection) { if (item is Outlook._MailItem) { Outlook._MailItem mailItem = (item as Outlook._MailItem); Outlook._MailItem reply = mailItem.ReplyAll(); AddTemplateDataToMailItem(reply, jiraTemplate); reply.Display(); } } } } catch (Exception Ex) { // To see this exception: Click on the email folders tree's top node i.e. the one which shows like a startup page // and contains Calendar information, tasks and messages overview. After that from ribbon click on the reply button. // http://stackoverflow.com/questions/17211827/how-to-check-if-a-vsto-outlook-explorer-object-has-been-closed // Ex.Message = "The Explorer has been closed and cannot be used for further operations. Review your code and restart Outlook." // Outlook gives valid explorer but selection paramter generates exception. //MessageBox.Show(Ex.Message + "\n" + Ex.StackTrace, "Error!!!"); RegistryOperation.CreateBinaryKeyValue(RegistryOperation.szAppRegPathGeneral, RegistryOperation.szKeyNameLastError, Ex.Message.ToString() + "\n" + Ex.StackTrace.ToString()); } }