Visual studio 正文更改时Outlook加载url
我正在VSTO中开发电子邮件跟踪应用程序。它在跟踪html正文中分配的url时加载跟踪url。发送按钮事件中的我的代码示例为Visual studio 正文更改时Outlook加载url,visual-studio,vsto,outlook-addin,Visual Studio,Vsto,Outlook Addin,我正在VSTO中开发电子邮件跟踪应用程序。它在跟踪html正文中分配的url时加载跟踪url。发送按钮事件中的我的代码示例为 private void Application_ItemSend(object Item, ref bool Cancel) { Outlook.MailItem mailItem = Item as Outlook.MailItem; string body = mailItem.HTMLBody; string imagurl = String.Format(
private void Application_ItemSend(object Item, ref bool Cancel)
{
Outlook.MailItem mailItem = Item as Outlook.MailItem;
string body = mailItem.HTMLBody;
string imagurl = String.Format("<img id='shtracking' src='{0}' border='0'
width='0' height='0'>",emailTrack);
int index2 = body.IndexOf("</body>");
string finalResult = body.Insert(index2, imagurl);
mailItem.HTMLBody = finalResult; //issue
}
private void Application\u ItemSend(对象项,参考bool Cancel)
{
Outlook.MailItem MailItem=作为Outlook.MailItem的项目;
字符串体=mailItem.HTMLBody;
string imagurl=string.Format(“,emailTrack”);
int index2=body.IndexOf(“”);
字符串finalResult=body.Insert(index2,imagurl);
mailItem.HTMLBody=finalResult;//问题
}
它会在发送消息之前重新加载页面。是否仍要在发送电子邮件之前阻止请求
感谢尝试取消提交(将cancel参数设置为true)并启动计时器-当它触发时,您将退出发送事件处理程序,因此您将能够调用
邮件项目。Close
关闭检查器。然后,您可以设置HTMLBody
属性并再次调用Send
。以某种方式标记该项,以避免再次在发送事件中处理它。您的代码何时运行?响应哪个OOM事件?我在发送事件中运行。私有无效应用程序_ItemSend(对象项,ref bool Cancel){//All code here}Hmmm。。。这是在设置HTMLBody属性时发生的,还是在Outlook仍显示消息时事件处理程序返回时发生的?这是在设置HTMLBody属性时发生的