View Single Post
  #3  
Old May 16th 08, 04:46 PM posted to microsoft.public.outlook.program_forms
Jon Rizzo
external usenet poster
 
Posts: 12
Default determining which item(s) are being deleted


Thanks for the information, Ken. That's what I was afraid of. can you
clarify what you meant by "No reliable way except for Outlook 2007"? Is
there a reliable way to do this in Outlook 2007?


"Ken Slovak - [MVP - Outlook]" wrote:

No reliable way except for Outlook 2007. Items.ItemRemove() doesn't provide
the item being deleted and it fires after the deletion. You can right-click
on an item and delete it without it being selected, so Explorer.Selection is
not viable.

You can check for ItemAdd on the Items collection of the Deleted Items
folder, but if the user hard deletes an item (Shift+Delete) the item won't
go there. About all you could do is index the items in a folder and check
after ItemRemove() to see which item or items are missing.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Jon Rizzo" wrote in message
...

I would like to execute some code when certain items are deleted. Is
there
any way to detect which items are being deleted in the Items.ItemRemove
event, and then query their properties before they are deleted? I tried
checking Explorer.Selection, but:

#1, I'm not confident that the current selection will ALWAYS contain the
items being deleted
#2, if I check the selected item's message class and then cast the object
onto the appropriate type (for example, ContactItem for "IPM.Contact") I
get
an InvalidCast.

Is there a way to (reliably) do what I'm trying to do?

Jon




Ads
 

Mortgage Calculator - Adverse Credit Remortgage - Hotels in Krakow - Personal Car Finance - Mortgage