Originally Posted by
bofonomo
Would it be possible to use VBA to combine the moving of the e-mail to the public folder with a check if that e-mail exists each time the rule is triggered?
See if something like this works in "Run a script" at the end of the rule.
Option Explicit
Sub move_public_mail(itm As mailItem)
Dim objNS As Namespace
Dim myPublicFolder As MAPIFolder
Dim i As Long
Dim copiedItm As mailItem
Set objNS = Application.GetNamespace("MAPI")
Set myPublicFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("first folder name").Folders("second folder name if any")
For i = 1 To myPublicFolder.Items.Count
If itm.Subject = myPublicFolder.Items(i).Subject And itm.SentOn = myPublicFolder.Items(i).SentOn Then
Debug.Print "Duplicate item."
GoTo exitRoutine
End If
Next
Set copiedItm = itm.Copy
copiedItm.Move myPublicFolder
exitRoutine:
Set copiedItm = Nothing
Set myPublicFolder = Nothing
Set objNS = Nothing
End Sub
Sub move_public_mail_test()
Dim currItem As Object
Set currItem = ActiveInspector.currentItem
If TypeOf currItem Is mailItem Then move_public_mail currItem
Set currItem = Nothing
End Sub