从 Outlook 发件箱中的邮件项目读取属性会导致其无法发送
我正在为 Outlook 2007 编写一个 VSTO 应用程序,该应用程序会定期检查发件箱中的邮件。我可以运行 MailItems 并检查 .Subscribed 属性,不会产生任何不利影响。但是,如果我读取 SentOn 属性,则 Outlook 中的邮件将不再显示为斜体,并且不再发送。
我必须去 mailitem.Send() 以确保它仍然被发送。
例如,
MAPIFolder folder = Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderOutbox) as MAPIFolder;
MailItem latest = null;
foreach (object item in folder.Items)
{
MailItem mailItem = item as MailItem;
if( mailItem != null && mailItem.Submitted )
{
if (latest == null || mailItem.SentOn > latest.SentOn)
{
latest = mailItem;
}
mailItem.Send(); // have to resend as checking the sent date takes it out the queue!
}
}
大多数属性似乎都是这种情况 - 但 .Subscribed 保持不变。无论如何我都没有改变它,所以我怎么能在没有它的情况下检查邮件呢。 (我应该补充一点,我有一条规则,将邮件延迟 1 分钟,这样我就可以在邮件离开时收到邮件)
I'm writing a VSTO app for Outlook 2007 that periodically checks mails in the Outbox. I can run over the MailItems and check the .Submitted property with no adverse effects. But if I read the SentOn property than the mail in Outlook stops being italicised and no longer gets sent.
I have to go mailitem.Send() to make sure it still gets sent.
e.g.
MAPIFolder folder = Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderOutbox) as MAPIFolder;
MailItem latest = null;
foreach (object item in folder.Items)
{
MailItem mailItem = item as MailItem;
if( mailItem != null && mailItem.Submitted )
{
if (latest == null || mailItem.SentOn > latest.SentOn)
{
latest = mailItem;
}
mailItem.Send(); // have to resend as checking the sent date takes it out the queue!
}
}
Seems to be the case with most properties - but .Submitted leaves it untouched. I've not changed it in anyway so how can I inspect the mail without it going. (I should add that i've got a rule that delays the mail for 1 minute so I can get the mails as they leave)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论