How to monitor deleted calendar events?

M

Mark Beiley

Hello,

I'm wondering the best way to monitor when an event gets deleted from the
calendar? There doesn't seem to be a notification for this specific event.
Instead, I've been monitoring the "Deleted Items" folder for any events
being added to this folder. I track events based on their Entry ID. This
seems to work, but I've run into a case where the Entry ID changes for a
specific event between the time it is on the calendar, and when it gets
added into the deleted items folder. This only seems to happen when running
the calendar on an exchange server (and not all exchange servers, just one
so far that I know of). I really have 2 questions:

Are there any better ways to track if a calendar event gets deleted?

Why/how would the exchange server put an event with a different Entry ID
into the Deleted Items folder when a calendar event gets deleted?

Thanks,
Mark
 
L

lsmiranda

I believe I have read somewhere that EntryID is not guaranteed to stay
the same, if the item is moved to a different folder, and has an even
higher chance of being changed if the item is being moved to a new
Store. Are you using outlook 2003 or 2007? As 2007 now has exposed
more events, specifically related to Deletion of items.
 
M

Mark Beiley

Thanks for the reply. My add-in needs to work on Outlook 2000, 2002, 2003,
and 2007, so I need
a way to find out when a calendar event is deleted for any of these
platforms.

Thanks,
Mark
 
K

Ken Slovak - [MVP - Outlook]

EntryID will change if an item is moved or deleted when using an Exchange
store provider. It doesn't change in those circumstances with a PST store
provider. If an item is moved to a different store EntryID always changes.

The best you'd be able to do is monitor the folder's ItemRemove event, which
fires after an item is deleted and doesn't point to the item, plus ItemAdd
on DeletedItems. If an item is hard deleted it won't go to Deleted Items.

If you have to monitor that you can only check which item or items are
missing from a list you maintain of the Items collection when you get
ItemRemove. That event won't fire if more than 16 items are deleted at once
or the last item in the folder is deleted. The only fix for those problems
is usually to use a timer to sweep the folder and see if anything was added
or is missing.
 
M

Mark Beiley

Thanks Ken, that is very helpful. Do I understand correctly that the
EntryID will 'always' change when using an Exchange store? How do you
learn this? Is it documented somewhere, or do you just learn by
trial/error?

I will pursue the idea of monitoring ItemRemove and maintaining my own list
of items.

Thanks,
Mark
--
Beiley Software
http://www.beiley.com


Ken Slovak - said:
EntryID will change if an item is moved or deleted when using an Exchange
store provider. It doesn't change in those circumstances with a PST store
provider. If an item is moved to a different store EntryID always changes.

The best you'd be able to do is monitor the folder's ItemRemove event,
which fires after an item is deleted and doesn't point to the item, plus
ItemAdd on DeletedItems. If an item is hard deleted it won't go to Deleted
Items.

If you have to monitor that you can only check which item or items are
missing from a list you maintain of the Items collection when you get
ItemRemove. That event won't fire if more than 16 items are deleted at
once or the last item in the folder is deleted. The only fix for those
problems is usually to use a timer to sweep the folder and see if anything
was added or is missing.
 
K

Ken Slovak - [MVP - Outlook]

I'm not sure if it's documented anywhere and each store provider implements
its own behavior as to changing EntryID or not, my own knowledge of that is
from lots of experience.

Things are better with Outlook 2007, in that version you have a
Folder.BeforeItemMove event that fires before an item is moved or deleted
from a folder. That event passes you Item, MoveTo and Cancel arguments.
Cancel lets you cancel the action by setting it True, Item is the item the
action is being taken on and MoveTo will be null (Nothing) if the item is
being deleted. MoveTo will pass the destination folder if it's a move and
not a delete.
 
M

Mark Beiley

Thanks again Ken. It is good to hear there are improvements available
in Outlook 2007. I'm going to have to stick with a solution that will
work for older versions too though...

Thanks,
Mark
 
K

Ken Slovak - [MVP - Outlook]

Yes, most of my addins still have to support Outlook 2000 and up (a few for
2002 and up) so most of the neat new features that Randy added to the
Outlook object model don't do me any good either. It is nice when I get an
Outlook 2007-only addin though :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top