outlook主题打破对话主题线程

时间:2016-10-24 18:51:16

标签: outlook

我们公司坚持使用" [外部]"为来自外部来源的每封电子邮件添加前缀。当外部人员回复电子邮件时,这会导致问题。因为" [外部]"作为主题的前缀,Outlook认为它是一个新的主题,打破了对话线程。我为每封传入的电子邮件创建了一个基于宏的规则。基本上我想剥离"外部"," RE"和" FW"因此,基础主题可以重新组合成一个对话。我希望有人帮我提供以下代码。我试图修改会话主题和会话索引,但它没有将项目分组在一起。

Sub FixSubject(oItem As Outlook.MailItem)
On Error Resume Next

Dim myolApp As Outlook.Application

Set myolApp = CreateObject("Outlook.Application")
Set mail = myolApp.ActiveExplorer.CurrentFolder

Dim aText As Variant, i As Long
aText = Array("[EXTERNAL]", "RE:", "FW:", "Re:", "Fw:")

For i = 0 To UBound(aText)
    oItem.Subject = Replace(oItem.Subject, aText(i), "", , , vbTextCompare)
Next

oItem.Subject = Trim(oItem.Subject)

'set the Conversation topic to the modified Subject
oItem.PropertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x0070001E", oItem.Subject

'set the Conversation Idex to null (I heard that OUtlook will use the topic instead)
oItem.PropertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x00710102", Null

oItem.Save

Set myolApp = Nothing
Set oItem = Nothing
End Sub

0 个答案:

没有答案