Is there an easy way to programatically create a reply message in a VSTO Outlook addin that includes the original message, with the same look that occurs when clicking on the built-in reply button in Outlook? Or does one need to write code to retrieve the original email properties & text, and format it such that it looks as if the reply was composed by Outlook?
1
votes
1 Answers
2
votes
How about:
using System.Runtime.InteropServices;
using Outlook = Microsoft.Office.Interop.Outlook;
private void Reply(Outlook._MailItem mailItem)
{
Outlook.Actions actions = mailItem.Actions;
Outlook.Action action = actions["Reply"];
Marshal.ReleaseComObject(actions);
action.ReplyStyle = Outlook.OlActionReplyStyle.olIncludeOriginalText;
Outlook._MailItem response = action.Execute() as Outlook.MailItem;
Marshal.ReleaseComObject(action);
response.Display();
Marshal.ReleaseComObject(response);
}