R
Rafael
I came across the code below and it is by far the most consistent method to
check for new emails that I've found.
Any how, the only problem I have is that it I receive multiple (two) meeting
updates, the code only fires once.
Any help with this will be greatly appreciated.
Code source: http://msdn2.microsoft.com/en-us/library/aa171304(office.11).aspx
Public WithEvents outApp As Outlook.Application
Sub Initialize_Handler()
Set outApp = Outlook.Application
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim mai As Object
Dim myMeeting As Outlook.MeetingItem
Dim intInitial As Integer
Dim intFinal As Integer
Dim strEntryId As String
Dim intLength As Integer
Dim ns As NameSpace
Set ns = Me.GetNamespace("MAPI")
Dim CurAppnt As Outlook.AppointmentItem
intInitial = 1
intLength = Len(EntryIDCollection)
'MsgBox "Collection of EntryIds: " & EntryIDCollection
intFinal = InStr(intInitial, EntryIDCollection, ",")
Do While intFinal <> 0
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intFinal -
intInitial))
Set mai = Application.Session.GetItemFromID(strEntryId)
intInitial = intFinal + 1
intFinal = InStr(intInitial, EntryIDCollection, ",")
Loop
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intLength -
intInitial) + 1)
'MsgBox strEntryId
Set mai = Application.Session.GetItemFromID(strEntryId)
If mai.MessageClass = "IPM.Schedule.Meeting.Request" Then
Set myMeeting = Application.Session.GetItemFromID(strEntryId)
Set CurAppnt = myMeeting.GetAssociatedAppointment(True)
' Do some stuff with associated appointment
CurAppnt.Save
End If
End Sub
Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String)
Initialize_Handler
End Sub
check for new emails that I've found.
Any how, the only problem I have is that it I receive multiple (two) meeting
updates, the code only fires once.
Any help with this will be greatly appreciated.
Code source: http://msdn2.microsoft.com/en-us/library/aa171304(office.11).aspx
Public WithEvents outApp As Outlook.Application
Sub Initialize_Handler()
Set outApp = Outlook.Application
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim mai As Object
Dim myMeeting As Outlook.MeetingItem
Dim intInitial As Integer
Dim intFinal As Integer
Dim strEntryId As String
Dim intLength As Integer
Dim ns As NameSpace
Set ns = Me.GetNamespace("MAPI")
Dim CurAppnt As Outlook.AppointmentItem
intInitial = 1
intLength = Len(EntryIDCollection)
'MsgBox "Collection of EntryIds: " & EntryIDCollection
intFinal = InStr(intInitial, EntryIDCollection, ",")
Do While intFinal <> 0
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intFinal -
intInitial))
Set mai = Application.Session.GetItemFromID(strEntryId)
intInitial = intFinal + 1
intFinal = InStr(intInitial, EntryIDCollection, ",")
Loop
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intLength -
intInitial) + 1)
'MsgBox strEntryId
Set mai = Application.Session.GetItemFromID(strEntryId)
If mai.MessageClass = "IPM.Schedule.Meeting.Request" Then
Set myMeeting = Application.Session.GetItemFromID(strEntryId)
Set CurAppnt = myMeeting.GetAssociatedAppointment(True)
' Do some stuff with associated appointment
CurAppnt.Save
End If
End Sub
Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String)
Initialize_Handler
End Sub