I have a code for Outlook that processes any incoming item and if given criteria are passed a new appointment is to be created in Outlook calendar from mail items only.
The code does not differentiate between mail item and meeting request item. This results in the system creating a new meeting in year 1899 from the meeting item instead ignoring this.
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
On Error Resume Next
Set ns = Application.Session
arr = Split(EntryIDCollection, ",")
For i = 0 To UBound(arr)
Set itm = ns.GetItemFromID(arr(i))
If (itm.Class = olMail) Then
Set objMail = itm
If objMail.Subject = "Approved" And objMail.Sender = "x@mail.com" Then
Set Reg1 = New RegExp
With Reg1
.Pattern = "([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})(\s)(\W)(\s)([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})"
.Global = True
End With
If Reg1.test(objMail.Body) Then
Set M1 = Reg1.Execute(objMail.Body)
For Each m In M1
Set objAppt = Application.CreateItem(olAppointmentItem)
Set objInsp = objAppt.GetInspector
Set objDoc = objInsp.WordEditor
Set objSel = objDoc.Windows(1).Selection
Next
End if
.....
End Sub