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

Registering events on calendar items on startup



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 6th 08, 04:54 PM posted to microsoft.public.outlook.program_addins
Manish
external usenet poster
 
Posts: 12
Default Registering events on calendar items on startup

I need to register for ItemEvents_10_BeforeDeleteEventHandler,
ItemEvents_10_PropertyChangeEventHandler on any Calendar Event that is
processed by my addin. For any calendar event handled by my addin, I
mainatin the Outlook Id in a database, and also set a user-property on the
outlook appt item.

I know of 2 ways to register for these event handlers for all my calendar
items. Question is which one is better. Can you please provide some insight.

1) On startup complete, I get a list of all calendar folders and iterate
through every item in each of the folders looking for either my user-property
being set, or if the outlook id matches ones in my database. For each such
item, I register the event handlers. Problem I see here is that the add-in
might take too long to load. Im not sure how many months/years of calendar
appts are returned if I called GetDefaultFolder.

2) I register for ExplorerEvents_10_BeforeFolderSwitchEventHandler on all
acitve explorers, and if the ToFolder is of type olAppointmentItem, then I
register for this.Application.ActiveExplorer().SelectionChange += new
Outlook.ExplorerEvents_10_SelectionChangeEventHand ler. Then when the user
selects an appointment Item, my callback can check if my user property is
set, and if so register for the property-change and delete event handlers.
problem with this approach is that my callback is being called on every
folder change and also on every item selection in an appointment folder.

Any suggestions on which approach is better? Thanks in advance.

- Manish
Ads
  #2  
Old May 7th 08, 12:14 AM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Registering events on calendar items on startup

Both of the events you mention are Item level events, best handled by
instantiating an Item and Inspector in the Inspectors.NewInspector() event
handler. You check the item type in that handler for
Inspector.CurrentItem.Class (use reflection for that) and if it's an
appointment or meeting item (whatever you want to handle) instantiate your
Item and Inspector objects.

Most of us use lists of Inspector wrapper classes to handle multiple open
items. In the wrapper class you instantiate the item event handlers you
want. That's a much more isolated approach, each item in its own Inspector
wrapper class and it keeps all the items in scope.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Manish" wrote in message
...
I need to register for ItemEvents_10_BeforeDeleteEventHandler,
ItemEvents_10_PropertyChangeEventHandler on any Calendar Event that is
processed by my addin. For any calendar event handled by my addin, I
mainatin the Outlook Id in a database, and also set a user-property on the
outlook appt item.

I know of 2 ways to register for these event handlers for all my calendar
items. Question is which one is better. Can you please provide some
insight.

1) On startup complete, I get a list of all calendar folders and iterate
through every item in each of the folders looking for either my
user-property
being set, or if the outlook id matches ones in my database. For each
such
item, I register the event handlers. Problem I see here is that the
add-in
might take too long to load. Im not sure how many months/years of
calendar
appts are returned if I called GetDefaultFolder.

2) I register for ExplorerEvents_10_BeforeFolderSwitchEventHandler on all
acitve explorers, and if the ToFolder is of type olAppointmentItem, then I
register for this.Application.ActiveExplorer().SelectionChange += new
Outlook.ExplorerEvents_10_SelectionChangeEventHand ler. Then when the user
selects an appointment Item, my callback can check if my user property is
set, and if so register for the property-change and delete event handlers.
problem with this approach is that my callback is being called on every
folder change and also on every item selection in an appointment folder.

Any suggestions on which approach is better? Thanks in advance.

- Manish


  #3  
Old May 12th 08, 05:15 PM posted to microsoft.public.outlook.program_addins
Manish
external usenet poster
 
Posts: 12
Default Registering events on calendar items on startup

Hi Ken,

Thanks for the response. I am using your suggested approach of having a
list of inspector wrappers. I used the TraveAgency sample from MSDN to
structure the code of my add-in. Although I do register for the events on
the outlook item in the inspector class, thats not good enough because the
user can modify the start-time, end-time, subject using the explorer view by
dragging and dropping the appointment or deleting it. I need to be notified
when this happens. So doing it at the inspector wrapper level is not
sufficient. Which is why I have to either register events for all of my
add-in's managed calender appointments or I have to register the events
during item selection.
Is my approach correct?

"Ken Slovak - [MVP - Outlook]" wrote:

Both of the events you mention are Item level events, best handhled by
instantiating an Item and Inspector in the Inspectors.NewInspector() event
handler. You check the item type in that handler for
Inspector.CurrentItem.Class (use reflection for that) and if it's an
appointment or meeting item (whatever you want to handle) instantiate your
Item and Inspector objects.

Most of us use lists of Inspector wrapper classes to handle multiple open
items. In the wrapper class you instantiate the item event handlers you
want. That's a much more isolated approach, each item in its own Inspector
wrapper class and it keeps all the items in scope.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Manish" wrote in message
...
I need to register for ItemEvents_10_BeforeDeleteEventHandler,
ItemEvents_10_PropertyChangeEventHandler on any Calendar Event that is
processed by my addin. For any calendar event handled by my addin, I
mainatin the Outlook Id in a database, and also set a user-property on the
outlook appt item.

I know of 2 ways to register for these event handlers for all my calendar
items. Question is which one is better. Can you please provide some
insight.

1) On startup complete, I get a list of all calendar folders and iterate
through every item in each of the folders looking for either my
user-property
being set, or if the outlook id matches ones in my database. For each
such
item, I register the event handlers. Problem I see here is that the
add-in
might take too long to load. Im not sure how many months/years of
calendar
appts are returned if I called GetDefaultFolder.

2) I register for ExplorerEvents_10_BeforeFolderSwitchEventHandler on all
acitve explorers, and if the ToFolder is of type olAppointmentItem, then I
register for this.Application.ActiveExplorer().SelectionChange += new
Outlook.ExplorerEvents_10_SelectionChangeEventHand ler. Then when the user
selects an appointment Item, my callback can check if my user property is
set, and if so register for the property-change and delete event handlers.
problem with this approach is that my callback is being called on every
folder change and also on every item selection in an appointment folder.

Any suggestions on which approach is better? Thanks in advance.

- Manish



  #4  
Old May 12th 08, 06:41 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Registering events on calendar items on startup

In that case registering for events you want for all items in the Selection
collection would be the way to go to handle changes from in-cell editing.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Manish" wrote in message
...
Hi Ken,

Thanks for the response. I am using your suggested approach of having a
list of inspector wrappers. I used the TraveAgency sample from MSDN to
structure the code of my add-in. Although I do register for the events on
the outlook item in the inspector class, thats not good enough because the
user can modify the start-time, end-time, subject using the explorer view
by
dragging and dropping the appointment or deleting it. I need to be
notified
when this happens. So doing it at the inspector wrapper level is not
sufficient. Which is why I have to either register events for all of my
add-in's managed calender appointments or I have to register the events
during item selection.
Is my approach correct?


  #5  
Old May 12th 08, 07:31 PM posted to microsoft.public.outlook.program_addins
Manish
external usenet poster
 
Posts: 12
Default Registering events on calendar items on startup

Thank you.

"Ken Slovak - [MVP - Outlook]" wrote:

In that case registering for events you want for all items in the Selection
collection would be the way to go to handle changes from in-cell editing.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Manish" wrote in message
...
Hi Ken,

Thanks for the response. I am using your suggested approach of having a
list of inspector wrappers. I used the TraveAgency sample from MSDN to
structure the code of my add-in. Although I do register for the events on
the outlook item in the inspector class, thats not good enough because the
user can modify the start-time, end-time, subject using the explorer view
by
dragging and dropping the appointment or deleting it. I need to be
notified
when this happens. So doing it at the inspector wrapper level is not
sufficient. Which is why I have to either register events for all of my
add-in's managed calender appointments or I have to register the events
during item selection.
Is my approach correct?



 




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
How do I un-delete calendar events from my deleted items RRGamache Outlook - Calandaring 1 January 28th 08 07:47 PM
Registering XLA macros / linking to buttons / making toolbars Bongo Outlook and VBA 1 November 1st 06 05:54 AM
Names in contact lists are not registering as e-mail addresses? jojo Outlook - Using Contacts 1 August 16th 06 03:41 PM
Hooking events for new items in a mail folder mika Outlook - Using Forms 0 February 17th 06 08:58 AM
path syntax while registering msoe.dll Tom Penharston Outlook Express 3 January 22nd 06 04:09 PM


All times are GMT +1. The time now is 05:10 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.