我使用了其他答案 文章的组合,并且本文编写了自己的宏,该宏使用Redemption库合并对话。
这将扫描当前文件夹,挑选出所有jira电子邮件,并从主题中提取问题密钥。如果它没有见过那个键,这样可以节省根据问题的关键集合中的谈话指标,如果它已经看到它之前,它更新与保存的交谈指数的电子邮件。
Dim ConversationIndexes As New Collection
Sub GroupJira()
Dim MapiNamespace As Object
Dim RdoSession As Object
Dim Item As Object
Dim RdoItem As Object
Dim ConversationKey As String
Dim ConversationIndex As String
' Get all the required handles
Set MapiNamespace = Outlook.GetNamespace("MAPI")
MapiNamespace.Logon
Set RdoSession = CreateObject("Redemption.RDOSession")
RdoSession.MAPIOBJECT = MapiNamespace.MAPIOBJECT
'Setup some subject patterns to extract the issue key
Dim Matches As MatchCollection
Dim UpdateSubjectPattern As New RegExp
UpdateSubjectPattern.Pattern = "\[JIRA\] \(([A-Z]+-[0-9]+)\) .*"
Dim MentionedSubjectPattern As New RegExp
MentionedSubjectPattern.Pattern = "\[JIRA\] .* mentioned you on ([A-Z]+-[0-9]+) \(JIRA\)"
For Each Item In Outlook.ActiveExplorer.CurrentFolder.Items
If TypeOf Item Is MailItem Then
If Left(Item.Subject, 7) = "[JIRA] " Then
' Get a key for this conversation, opic for now
ConversationKey = Item.ConversationTopic
Set Matches = UpdateSubjectPattern.Execute(Item.Subject)
If Matches.Count >= 1 Then ConversationKey = Matches(0).SubMatches(0)
Set Matches = MentionedSubjectPattern.Execute(Item.Subject)
If Matches.Count >= 1 Then ConversationKey = Matches(0).SubMatches(0)
' Get any saved indexes
ConversationIndex = ""
On Error Resume Next
ConversationIndex = ConversationIndexes.Item(ConversationKey)
On Error GoTo 0
If ConversationIndex = "" Then
' Save this index if not seen yet
ConversationIndexes.Add Item.ConversationIndex, ConversationKey
ElseIf Item.ConversationIndex <> ConversationIndex Then
' Set the item's index if it has
Set RdoItem = RdoSession.GetMessageFromID(Item.EntryID, Item.Parent.StoreID)
RdoItem.ConversationIndex = ConversationIndex
RdoItem.Save
End If
End If
End If
Next Item
End Sub
这需要以下库:
- 用于完全RDO访问的兑换库,需要设置会话索引(不需要提升即可注册)
- 对
Microsoft VBScript Regular Expressions 5.5
库的引用,以从邮件主题中提取发布密钥。
哦,您还需要调整宏安全性设置才能运行它。