PC Review


Reply
Thread Tools Rate Thread

ItemAdd event fires more than once when adding a new appointment

 
 
Johan Machielse
Guest
Posts: n/a
 
      22nd Jul 2008
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
 
Reply With Quote
 
 
 
 
Johan Machielse
Guest
Posts: n/a
 
      22nd Jul 2008
Already solved; I added the handler to the event at two places!

"Johan Machielse" wrote:

> 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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ItemAdd event with Outlook2007 =?Utf-8?B?RGF2aWRIJlA=?= Microsoft Outlook Form Programming 2 4th Jul 2006 09:29 AM
Handling the ItemAdd event =?Utf-8?B?Qm9uZ28=?= Microsoft Outlook VBA Programming 1 18th May 2005 04:02 PM
ItemAdd event Duncan Bates Microsoft Outlook Program Addins 1 30th Jul 2004 11:23 AM
MAPI ItemAdd Event Question muser8@hotmail.com Microsoft Outlook Program Addins 4 16th Jun 2004 08:06 PM
comboBox TextChanged event fires twice because Items.Insert() fires the event too... Rob Hindman Microsoft Dot NET Framework Forms 2 25th Aug 2003 08:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:35 AM.