BeforeDelete

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 
F

Freudi

Thank you, but ...
What can I use to catch a item that was deleted ?
ItemRemove was sent when the item is already gone ?

Freudi
 
K

Ken Slovak - [MVP - Outlook]

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.
 
G

Guest

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
 
K

Ken Slovak - [MVP - Outlook]

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

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