yronnen
asked on
Catch an Item delete
Hi,
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?
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?
ASKER
Adjusted points to 200
ASKER
Adjusted points to 250
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.
Syntax
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: http://www.cdolive.com/agent3.htm
-----------------
ItemRemove Event
Occurs when an item is deleted from the specified collection. This event is not available in VBScript.
Syntax
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: http://www.cdolive.com/agent3.htm
ASKER
Pstry,
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("MAP I").GetDef aultFolder (olFolderC alendar).I tems
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.
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("MAP
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.
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.
ASKER
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.
So I MUST catch a delete event when it happens and know what was deleted.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER