![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to fire NewMail&NewMailEx Event? | baryon | Outlook - General Queries | 0 | August 17th 06 04:31 PM |
ThisOutlookSession - code runs only once | Rafael1119 | Outlook and VBA | 8 | July 17th 06 11:51 AM |
Outlook 2003 "find" contacts doesn't work, just runs and runs | Tom Stanley | Outlook - Using Contacts | 1 | July 5th 06 03:56 AM |
NewMailEx vs. ItemAdd | Mark Rae | Outlook and VBA | 14 | June 15th 06 03:07 PM |
Code runs in design mode | karlman | Outlook - Using Forms | 2 | January 27th 06 05:49 PM |