将属性添加到 MailItem 时,如何防止保存 Outlook MailItem 未保存的草稿?
当人们开始在 Outlook 中撰写电子邮件时,它会以“未保存的草稿”的形式存在。如果您关闭电子邮件,系统会提示您保存/放弃草稿。在保存草稿之前,电子邮件不存在于草稿项目文件夹中。
我需要向未保存的草稿 MailItem 添加一个属性,并使 MailItem 保持未保存的草稿状态。不幸的是,使用 MailItem.Save 会导致MailItem 成为保存的草稿。
有没有办法阻止 MailItem 成为已保存的草稿或在保存后将其恢复为未保存的草稿?
When one begins composing an email in Outlook it exists as an "unsaved draft". If you close the email you are prompted to save/discard the draft. Until one saves the draft the email does not exist in one's draft items folder.
I need to add a property to an unsaved draft MailItem and for the MailItem to remain in an unsaved draft state. Unfortunately, using MailItem.Save results in the MailItem becoming a saved draft.
Is there a way to either prevent the MailItem from being a saved draft or to revert it to an unsaved draft after the save?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
捕获
MailItem.Write
事件并在事件处理程序中设置您的自定义属性。这样,只有在保存消息之前才会设置该属性。Trap the
MailItem.Write
event and set your custom property in the event handler. This way the property will only be set only before the message is saved.您可以添加自定义属性并调用
Save
方法来避免出现此类对话框。否则,请考虑将任何自定义数据保留在 Outlook 项目之外。它可以是数据库或任何其他存储,您可以在其中获取特定项目的数据。
You can add your custom property and call the
Save
method to avoid such dialogs.Otherwise, consider keeping any custom data out of the Outlook item. It can be a DB or any other storage where you can grab the data for a particular item.
我发现我可以向仅存在于内存中(未保存)的草稿 (
MailItem
) 添加一个属性,如果我不调用MailItem.Write()
或MailItem.Save()
属性已添加且可访问,但草稿仍未保存。如果草稿在某个时刻被保存(而不是被丢弃),则该属性将与
MailItem
的其余部分一起保留。I found that I can add a property to a draft (
MailItem
) that exists only in memory (it is unsaved) and if I don't callMailItem.Write()
orMailItem.Save()
the property is added and accessible and the draft remaiins unsaved.If the draft is saved (rather than discarded) at some point then the property is persisted along with the rest of the
MailItem
.