我有一个插件,当我回复邮件时会询问应将回复保存到哪个文件夹。我需要扩展它以移动我回复的邮件(例如,父邮件),也要保存到我为回复邮件选择的文件夹中。
如果我可以以某种会话ID作为父邮件的对象,我觉得可以做到这一点吗?
Public Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim myFolder As MAPIFolder
Dim myOlApp As Outlook.Application
Dim myOlExp As Outlook.Explorer
If Environ("MailSave") = True Then
If TypeName(Item) = "MailItem" Then
Set myOlApp = CreateObject("Outlook.Application")
Set olNS = myOlApp.GetNamespace("MAPI")
Set myFolder = olNS.PickFolder
'todo
If Not (myFolder Is Nothing) Then
Set Item.SaveSentMessageFolder = myFolder
'Item.Parent.Move myFolder ---I tried this. But it is wrong I know
' MsgBox ("All moved")
End If
End If
End If
End Sub
答案 0 :(得分:1)
您可能会看到“ In-Reply-To”标头(由PR_IN_REPLY_TO_ID MAPI属性公开),但是这些值是在激发ItemSend事件后写入的。
我建议处理MailItem.Reply事件,该事件在用户选择某项的Reply操作时或为该项目调用Reply方法时触发。另外,您可能对MailItem.Forward事件感兴趣,该事件在用户为某个项目选择“前进”操作时或在为该项目调用“前进”方法时触发。
Public WithEvents myItem As MailItem
Sub Initialize_Handler()
Set myItem = Application.ActiveInspector.CurrentItem
End Sub
Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean)
Set Response.SaveSentMessageFolder = myItem.Parent
End Sub
因此,按照这种方式,您将可以访问原始项目并设置SaveSentMessageFolder
属性。