Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / May 2008

Tip: Looking for answers? Try searching our database.

determining which item(s) are being deleted

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Rizzo - 15 May 2008 19:57 GMT
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
Ken Slovak - [MVP - Outlook] - 16 May 2008 14:23 GMT
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.

Signature

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

> I would like to execute some code when certain items are deleted.  Is
> there
[quoted text clipped - 12 lines]
>
> Jon
Jon Rizzo - 16 May 2008 16:46 GMT
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?

> 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
[quoted text clipped - 22 lines]
> >
> > Jon
Ken Slovak - [MVP - Outlook] - 19 May 2008 21:38 GMT
BeforeItemMove in Outlook 2007 is what we've asked for for a long time. The
target folder is null (Nothing) if the item is being deleted, you get the
item reference and there's a cancel argument.

Signature

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

> 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?
Jon Rizzo - 19 May 2008 21:52 GMT
I missed that one - thanks Ken!

Jon

> BeforeItemMove in Outlook 2007 is what we've asked for for a long time. The
> target folder is null (Nothing) if the item is being deleted, you get the
[quoted text clipped - 3 lines]
> > clarify what you meant by "No reliable way except for Outlook 2007"?  Is
> > there a reliable way to do this in Outlook 2007?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.