为什么在Outlook 2013中以撰写模式显示在“已发送邮件"文件夹中创建的MailItems [英] Why are MailItems created in Sent Items folder shown in compose mode in Outlook 2013

查看:263
本文介绍了为什么在Outlook 2013中以撰写模式显示在“已发送邮件"文件夹中创建的MailItems的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Outlook 2013加载项,其中有一个ItemSend Eventhandler,我无法正常工作.

I have a Outlook 2013 addin that has a ItemSend Eventhandler that I can't get to work right.

它的作用是:

  1. 环绕所有收件人(收件人,抄送,密件抄送),并为每个收件人创建一个单独的副本,并仅以该电子邮件作为收件人并将其发送.然后从发送的邮件文件夹中删除它们.效果很好.

  1. Loops all recipients (to, cc, bcc) and creates a separate copy for each with only that email as recipient and sends them. Then deletes them from sent mail folder. This works fine.

再创建一个副本,该副本具有原始的收件人,抄送和密件抄送信息.使用移动方法将其移动到已发送邮件"文件夹中,因为保存"会将其放置在发件箱"中.一定不要实际发送它,它应该只是您的个人副本,就好像可以正常发送一样.

Creates one more copy, that has the original to, cc and bcc information. Uses the move-method to move it to the Sent items folder, because Save would put it in Outbox. It must not be actually sent, it should be just your personal copy as if it would have been sent normally.

设置cancel = true并使用discard关闭检查器窗口,因此也不会发送任何原始文件.这也可以.

Sets cancel = true and closes the inspector window with discard, so the original is never sent either. This works too.

问题是保存的副本.当我打开它时,它处于撰写模式.基本上与草稿相同.我希望以阅读模式查看它的发送状态.

The problem is the saved copy. When I open it, it's in compose mode. Basically it is same as it would be a draft. I want to see it as it would have been sent, in read mode.

我读到Sent属性决定以哪种模式显示它,但是该属性是只读的,SentOn也为null,即使该模式正确,也将是一个问题.有没有办法解决?

I read that the Sent-property determines what mode to show it in, but that property is readonly, as are SentOn which is null and that would be a problem too even if the mode would be right. Is there any way around this?

我什至尝试从已发送邮件"文件夹中接收实际发送的其他邮件之一,编辑内容并保存.但这会导致相同的行为.此外,MailItem的Sent = False和SentOn = null.

I even tried to take one of the other mails that where actually sent, from Sent Items folder, edit the content and save it. But this results in the same behaviour. Also that MailItem has Sent = False and SentOn = null.

这可能是因为即使调用了Send-,实际上尚未发送该消息,因为我们仍在运行EventHandler,并且我不认为Outlook实际上会在另一个线程中发送它吗?

Could this be because it hasn't actually been sent yet even if Send-was called, as we are still running the EventHandler and I don't think Outlook actually sends it in another thread?

无论如何,这似乎不是可行的解决方法.

Anyway this doesn't seem to be a working workaround.

任何想法如何实现这种功能?

Any ideas how to implement this kind of functionality?

推荐答案

在低(扩展MAPI)级别上,仅在第一次保存该项之前,才可以从PR_MESSAGE_FLAGS属性中删除MSGFLAG_UNSENT位( MAPI限制).

On the low (Extended MAPI) level, the MSGFLAG_UNSENT bit can be removed from the PR_MESSAGE_FLAGS property only before the item is saved for the very first time (MAPI limitation).

在发送状态下创建的唯一OOM项目是发布项目.创建一个帖子项目,将其MessageClass属性更改回IPM.Note,保存它,记住该项目的条目ID,使用Marshal.ReleaseComObject(如果是.Net)释放该帖子项目,然后使用Namespace.GetItemfromId重新打开它-您将在发送状态下具有MailItem对象.您仍然需要更新/删除PR_ICON_INDEX属性,以确保图标正确.

The only OOM item ever created in the sent state is the post item. Create a post item, change its MessageClass property back to IPM.Note, save it, remember the item's entry id, release the post item using Marshal.ReleaseComObject (in case of .Net), then reopen it using Namespace.GetItemfromId - you will have MailItem object in the sent state. You will still need to update/delete the PR_ICON_INDEX property to make sure the icon is right.

如果使用赎回是一个选项,则可以设置Sent属性(在保存之前)以及SentOn/ReceivedTime/Sender/SentOnBehalfOf属性.

If using Redemption is an option, it allows to set the Sent property (before it is saved) as well as SentOn / ReceivedTime / Sender / SentOnBehalfOf properties.

在我的头顶上:

RDOSession rdoSession = new RDOSession();
rdoSession.MAPIOBJECT = Globals.ThisAddIn.Application.Session.MAPIOBJECT;
RDOFolder rdoFolder = rdoSession.GetDefaultFolder(rdoDefaultFolders.olFolderSentMail);
RDOMail rdoItem = rdoInbox.Items.Add("IPM.Note");
rdoItem.Sent = true;
rdoItem.Recipients.AddEx("Joe The User", "user@domain.demo", "SMTP");
rdoItem.Subject = "test";
rdoItem.Body = "test body";
rdoItem.UnRead = false;
rdoItem.SentOn = rdoItem.ReceivedTime = new DateTime(2016, 10, 6, 8, 44, 0);
rdoItem.Sender = rdoItem.SentOnBehalfOf = rdoSession.CurrentUser;
rdoItem.Save();

这篇关于为什么在Outlook 2013中以撰写模式显示在“已发送邮件"文件夹中创建的MailItems的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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