简体   繁体   English

使用C#的VSTO Outlook ItemSend

[英]VSTO Outlook ItemSend with C#

I'm trying to add a string in the end of an Outlook email's body with VSTO 我正在尝试使用VSTO在Outlook电子邮件的正文末尾添加一个字符串

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();
        }
    }

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 当我用V5运行我的代码来自VStudio时, 应用程序没有在我的断点处停止并且电子邮件不包含添加的行

What I can do about it? 我能做些什么呢?

Note : I'm working with VS2008 and Outlook 2007 注意 :我正在使用VS2008和Outlook 2007

Thanks in advance 提前致谢

Sorry... 抱歉...

The problem was i've to close my outlook and restarted with F5. 问题是我要关闭我的前景并重新启动F5。

If someone have this same issue, now you know 如果有人有同样的问题,现在你知道了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM