重写 Outlook 邮件项目的 RecievedTime 属性
在我的公司,我们使用与 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们通过购买一个程序来解决这个问题,该程序可以将所有项目从一个电子邮件系统迁移到另一个电子邮件系统。这称为 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!