BeforeDelete

  • Thread starter Thread starter Freudi
  • Start date Start date
F

Freudi

Since Outlook2002 there has to be a "BeforeDelete" Event
for all items. But it doesent fire ?
I have that in my Code

Public WithEvents myOlItems As Outlook.Items
Public Sub Initialize_handler()
Set myOlItems = GetNamespace("MAPI").GetDefaultFolder
(olFolderCalendar).Items
End Sub
Private Sub Application_Startup()
Call Initialize_handler
End Sub
Private Sub myOlItems_ItemAdd(ByVal item As Object)
MsgBox("Add OK") ' That works
End Sub
Private Sub myOlItems_BeforeDelete(ByVal item As Object,
Cancel As Boolean)
MsgBox("Add OK") ' That don't works
End Sub
 
BeforeDelete is pretty useless. It only fires when you delete an item
that is open using the File, Delete menu command. It won't fire if the
item is deleted from a folder view.
 
Thank you, but ...
What can I use to catch a item that was deleted ?
ItemRemove was sent when the item is already gone ?

Freudi
 
You can use ItemAdd on the Items collection of the Deleted Items
folder to catch all deletions except for those where the user uses
Shift+Delete to hard delete the items. If you needed to track those
also you would have to set up a tracking system that kept tabs on each
item in the folder and compared that collection to what exists at some
other point in time.
 
Thank you I think thats enough.
I just started with an ATL-Addin programmed in C++. Is
there chance to catch that shift-del-Event in COM or
Extend MAPI ?

Freudi
 
COM has nothing to do with it. I can't answer for Extended MAPI, I
don't really use it.
 
Back
Top