开发者

VSTO Outlook ItemSend with C#

开发者 https://www.devze.com 2023-01-25 08:45 出处:网络
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)

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

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

What I can do about it?

Note: I'm working with VS2008 and Outlook 2007

Thanks in advance


Sorry...

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

If someone have this same issue, now you know

0

精彩评论

暂无评论...
验证码 换一张
取 消