![]() |
NewMailEx Code runs only once...
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/lib...ffice.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 |
All times are GMT +1. The time now is 07:58 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com