ItemAdd event fires more than once when adding a new appointment

  • Thread starter Thread starter Johan Machielse
  • Start date Start date
J

Johan Machielse

Dear Reader,

I figured out that the ItemAdd event fires more than once when I add a new
appointment to the calendar in Outlook 2003! After a couple of ItemAdd events
one ItemChanged event is fired! It also seems that when there are more items
in the calendar, more ItemAdd events will be fired...

Does anyone know the cause of this strange behaviour and the solution?

Here's the code snippet which is executed in the OnStartupComplete() method
of my add-in:

Outlook.Application application =
(Microsoft.Office.Interop.Outlook.Application)applicationObject;
Outlook.NameSpace mapiNamespace = application.GetNamespace("MAPI");
Outlook.MAPIFolder calendarFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

calendarFolder.Items.ItemAdd += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
calendarFolder.Items.ItemChange += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemChangeEventHandler(Items_ItemChange);

Thank you in advance!

Johan Machielse
Avanade
 
Back
Top