发送Outlook.Mailitem后将其另存为文件(C#) [英] Saving an Outlook.Mailitem as a file after it has been sent (c#)

查看:176
本文介绍了发送Outlook.Mailitem后将其另存为文件(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于

Based on this issue, I can save an Outlook.Mailitem object as a file when it is being sent:

..
using Outlook = Microsoft.Office.Interop.Outlook;
...
public partial class MyClass: DevExpress.XtraEditors.XtraUserControl
{
    static Microsoft.Office.Interop.Outlook.MailItem mailItem;
    ...    
    public static void SendAnOutlookMail()
    {
       ...
       mailItem.Display(false);
       ((Outlook.ItemEvents_10_Event)mailItem).Send += new Microsoft.Office.Interop.Outlook.ItemEvents_10_SendEventHandler(ThisAddIn_Send);
       ...
    };

    static void ThisAddIn_Send(ref bool Cancel)
    {
       mailItem.SaveAs(@"d:\1\sent.msg");
    }
    ...
}

我唯一的问题是,生成的文件是在发送之前( )处于状态的电子邮件(当我打开该文件时,可以按其上的发送"按钮).

My only problem is that the resulting file is an email in its state just before it has been sent (when I open it, I can press the send button on it).

我的问题:如何将其保存为已发送状态?

My question: How could I save it in the sent state?

推荐答案

最早可以访问处于已发送状态的项目,并且已填充的发件人信息位于已发送邮件"文件夹中的Items.ItemAdd事件处理程序中.

the earliest you can access the item in its sent state and the sender information populated is in the Items.ItemAdd event handler on the Sent Items folder.

这篇关于发送Outlook.Mailitem后将其另存为文件(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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