Catch an Item delete


I'm customizing the appointment form.
How can I capture the DELETE event of
an existing form (when the user clicks
the delete button and confirms) using vb / vbscript?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yronnenAuthor Commented:
Edited text of question.
yronnenAuthor Commented:
Adjusted points to 200
yronnenAuthor Commented:
Adjusted points to 250
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Piotr StrycharzSoftware/web developerCommented:
As of my knowledge: you cannot capture this event in Outlook. Below follows MSDN explanation:
ItemRemove Event

Occurs when an item is deleted from the specified collection. This event is not available in VBScript.


Sub object_ItemRemove()

object An expression that evaluates to an Items collection object

As you can see this event is not available in VBSCRIPT. However you CAN capture it using public folders. There exists Folder_OnMessageDeleted function. Fired (by MS Exchange Event Service) - guess when ? - when message is deleted. Details:
yronnenAuthor Commented:
your answer requires that I install CDO on each of the outlook clients.

The problem is that most of the time these computers are not connected to the network (laptops).

I've tried using the item_remove by:
1. using getobject from my com object to get a reference to the existing outlook application.
2. Since I'm customizing an appointment form I've typed: Set OlItems = objOLApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
and declared OlItems as items with events - so now I have a pointer to the items collection.

The problem is that the events (especially the remove event) are not working.
You have writtent that you declared Items object with events. You should use a single item (i.e. AppointmentItem) object with events.

Also I've noticed that when item is deleted Write event occurs. It may help - catch this event, and after a while check if the item still exists in collection. if it doesn't it probably was deleted.
yronnenAuthor Commented:
Sorry, but that's not a good one. I've tried this method before, and the problem is that I can't use the find method using the EntryID as a search criteria. Meaning - you cannot search an outlook item using it's unique key...

So I MUST catch a delete event when it happens and know what was deleted.
There is no surefire solution to your issue in the current Outlook/Exchange environment, for the reasons detailed in previous comments.

Exchange 2000 will, for the first time, introduce a synchronous server-based event for catching item deletions before they happen -- when it is still possible to get information out of the item.

Workarounds in the current climate center on monitoring the Deleted Items folder for new items. (This, of course, misses anything deleted with Shift+Delete.)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.