VSTO Outlook ItemSend 与 C# [英] VSTO Outlook ItemSend with C#

查看:22
本文介绍了VSTO Outlook ItemSend 与 C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 VSTO 在 Outlook 电子邮件正文的末尾添加一个字符串

I'm trying to add a string in the end of an Outlook email's body with VSTO

private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        this.Application.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
    }

    void Application_ItemSend(object Item, ref bool Cancel)
    {
        if (Item is Outlook.MailItem)
        {
            Outlook.MailItem mail = (Outlook.MailItem)Item;
            mail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
            mail.Body += "My Sample Text";
            mail.Save();
        }
    }

当我使用 F5 从 VStudio 运行我的代码时,应用程序不会在我的断点处停止并且电子邮件不包含添加的行

When i run with F5 my code from VStudio, the app isn't stopping in my breakpoints and the emails do not contain the added line

我能做些什么?

注意:我使用的是 VS2008 和 Outlook 2007

Note: I'm working with VS2008 and Outlook 2007

提前致谢

推荐答案

对不起...

问题是我必须关闭 Outlook 并使用 F5 重新启动.

The problem was i've to close my outlook and restarted with F5.

如果有人遇到同样的问题,现在您知道了

If someone have this same issue, now you know

这篇关于VSTO Outlook ItemSend 与 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆