A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

ItemAdd event fires more than once when adding a new appointment



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 22nd 08, 08:56 AM posted to microsoft.public.outlook.program_addins
Johan Machielse[_2_]
external usenet poster
 
Posts: 11
Default ItemAdd event fires more than once when adding a new appointment

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)appl icationObject;
Outlook.NameSpace mapiNamespace = application.GetNamespace("MAPI");
Outlook.MAPIFolder calendarFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olFolderCalendar);

calendarFolder.Items.ItemAdd += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemA ddEventHandler(Items_ItemAdd);
calendarFolder.Items.ItemChange += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemC hangeEventHandler(Items_ItemChange);

Thank you in advance!

Johan Machielse
Avanade
  #2  
Old July 22nd 08, 12:11 PM posted to microsoft.public.outlook.program_addins
Johan Machielse[_2_]
external usenet poster
 
Posts: 11
Default ItemAdd event fires more than once when adding a new appointment

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)appl icationObject;
Outlook.NameSpace mapiNamespace = application.GetNamespace("MAPI");
Outlook.MAPIFolder calendarFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olFolderCalendar);

calendarFolder.Items.ItemAdd += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemA ddEventHandler(Items_ItemAdd);
calendarFolder.Items.ItemChange += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemC hangeEventHandler(Items_ItemChange);

Thank you in advance!

Johan Machielse
Avanade

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
(VSTO SE) folder.Items.ItemAdd Event does not fire David Outlook and VBA 5 March 7th 07 08:41 PM
event echo (event fires twice) vba/vb smanky Outlook and VBA 0 November 9th 06 01:16 PM
Explorer closing before Item Add event fires?? AndyK Outlook and VBA 3 November 3rd 06 02:22 PM
Problem with CommandBarComboBox Change Event (Event fires only once) M. Khalid Farooq Add-ins for Outlook 1 October 19th 06 02:34 PM
ItemAdd event with Outlook2007 DavidH&P Outlook - Using Forms 2 July 4th 06 08:29 AM


All times are GMT +1. The time now is 12:35 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-2025 Outlook Banter.
The comments are property of their posters.