vba - 复制到 Outlook 公用文件夹时电子邮件属性丢失

标签 vba outlook

我的 VBA 应用程序将选定的、本地存储的电子邮件移动/复制到我具有完全访问权限的指定公共(public)文件夹。

问题是移动/复制电子邮件后,“收件人”和“发件人”属性会变得困惑。即:

原文来自:GuyA

原文致:我

搬家后发件人:我

移动后到:公用文件夹的名称

我尝试了以下操作,但似乎对公共(public)文件夹中的电子邮件没有任何影响

For Each email In a1Bucket.items
    sender = email.SentOnBehalfOfName
    receiver = email.ReceivedOnBehalfOfName
    email.Move largeBucket
    email.SentOnBehalfOfName = sender
    email.To = receiver
Next

我错过了什么?

最佳答案

试试这个(在本地文件夹上测试)

For Each Email In a1Bucket.items
    sender = Email.SentOnBehalfOfName
    receiver = Email.ReceivedOnBehalfOfName
    Set currentMailItem = Email.Move (largeBucket)
    currentMailItem.SentOnBehalfOfName = sender
    currentMailItem.To = receiver
    currentMailItem.Save
Next

关于vba - 复制到 Outlook 公用文件夹时电子邮件属性丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11955616/

相关文章:

mysql - 使用 VBA 将 mySQL 数据库中的值提取到 Excel 中

excel - 如何卡住Excel中的多行和多列?

VBA - 如何声明 "Cell"变量

使用Outlook发送电子邮件的C++算法

html - Outlook - 转发/回复删除显示 :none inline-style

excel - Folder.Items 中缺少发件人、SenderEmailAddress

php - 使用 php 脚本将事件添加到 outlook 日历

excel - 查找对象库vba的VBIDE.Reference.Name

vba - 将 Excel-VBA 代码放入模块或工作表中?

vba - 在 access 97 中查找完整路径的目录部分(减去文件名)