重写 Outlook 邮件项目的 RecievedTime 属性

发布于 2024-09-10 22:14:21 字数 1266 浏览 3 评论 0原文

在我的公司,我们使用与 Outlook 不同的电子邮件客户端。当我们将对话复制到 Exchange imap 文件夹时,receivedtime 属性将设置为当前日期。

是否可以通过编程方式更改此属性?目前我收到此属性是只读的错误。

我当前的代码:


private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    foreach (Outlook.Folder Map in Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Folders)
    {
        if (Map.Name != "some_name")
            continue;
        if (MessageBox.Show("mes", "title", MessageBoxButtons.OKCancel) != DialogResult.OK)
            break;
        foreach (Object Item in Map.Items)
        {
            try
            {
                String Message = "";
                Outlook.MailItem Mail = (Outlook.MailItem)Item;
                Message += "Sent by: \"" + Mail.SenderName + "\" \n";
                Message += "Sent on: " + Mail.SentOn.ToString() + "\n";
                Message += "Received on: " + Mail.ReceivedTime.ToString();
                MessageBox.Show(Message);

                Mail.ReceivedTime = Mail.SentOn;
               //Property or indexer 'Microsoft.Office.Interop.Outlook._MailItem.ReceivedTime' cannot be assigned to: it is read only
            }
            catch (Exception Exception)
            {
            }
        }
    }
}

Here at my company we use a E-mailclient different then Outlook. When we copy our conversations to the Exchange imap folder, the recievedtime property is set to the current date.

Is it possible to programmaticaly change this property? Currently I get the error that this property is read-only.

My current code:


private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    foreach (Outlook.Folder Map in Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Folders)
    {
        if (Map.Name != "some_name")
            continue;
        if (MessageBox.Show("mes", "title", MessageBoxButtons.OKCancel) != DialogResult.OK)
            break;
        foreach (Object Item in Map.Items)
        {
            try
            {
                String Message = "";
                Outlook.MailItem Mail = (Outlook.MailItem)Item;
                Message += "Sent by: \"" + Mail.SenderName + "\" \n";
                Message += "Sent on: " + Mail.SentOn.ToString() + "\n";
                Message += "Received on: " + Mail.ReceivedTime.ToString();
                MessageBox.Show(Message);

                Mail.ReceivedTime = Mail.SentOn;
               //Property or indexer 'Microsoft.Office.Interop.Outlook._MailItem.ReceivedTime' cannot be assigned to: it is read only
            }
            catch (Exception Exception)
            {
            }
        }
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

森林很绿却致人迷途 2024-09-17 22:14:21

我们通过购买一个程序来解决这个问题,该程序可以将所有项目从一个电子邮件系统迁移到另一个电子邮件系统。这称为 Transend 迁移 (http://www.transend.com)。该程序读取您的所有电子邮件,然后将它们写回新系统。

希望有帮助!

We solved this problem by purchasing a program that migrates all items from one e-mailsystem to an other. It's called Transend Migration (http://www.transend.com). The program reads al your e-mails and then writes them back to the new system.

Hope it helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文