Question

I'm using interrop to handle changing events in outlook so when a calandar item is chaged i can display a message.The problem is that it fire the event 3 times :s.

here is the code :

Private Sub mCalendarItems_ItemChangeEvent(ByVal Item As NetOffice.COMObject) Handles                     mCalendarItems.ItemChangeEvent
           Dim i As outlook.AppointmentItem = Nothing
           i = DirectCast(Item, outlook.AppointmentItem) 
        If i IsNot Nothing Then
            MessageBox.Show("Vous venez de modifier la tâche " & i.Subject)
            Application.DoEvents()
         End If
    i = Nothing End Sub

Any help ?

Était-ce utile?

La solution

If an item is saved 3 times, the event will be fired 3 times.

How do you set up the event handler? Is it possible that you set up the event hook 3 times?

How many times does even fire if you look at the folder in OutlookSpy? Click the Folder button on the OutlookSpy toolbar ("Outlook Object Model" group), select the Items property, click Browse. In the new Items window, go to the Events tab. Modify an appointment, look at the Log box at the bottom of the Events tab.

Autres conseils

I gad the same problem, but found out it had nothing to do with the event handler. The reason for the multiple events were, that I have HotMail Connector installed and this will modify the Item two times when synchronizing.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top