A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , ,

determining which item(s) are being deleted





 
 
Thread Tools Display Modes
  #1  
Old May 15th 08, 07:57 PM posted to microsoft.public.outlook.program_forms
Jon Rizzo
external usenet poster
 
Posts: 12
Default determining which item(s) are being deleted


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
  #2  
Old May 16th 08, 02:23 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,033
Default determining which item(s) are being deleted

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



  #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




  #4  
Old May 19th 08, 09:38 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 3,033
Default determining which item(s) are being deleted

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.

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

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?


  #5  
Old May 19th 08, 09:52 PM posted to microsoft.public.outlook.program_forms
Jon Rizzo
external usenet poster
 
Posts: 12
Default determining which item(s) are being deleted


I missed that one - thanks Ken!

Jon


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

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.

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

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?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I retrieve an item deleted on a clickboard? Anyidea? Outlook - Calandaring 0 October 9th 07 10:26 PM
How does one find out that an item is deleted? (all Outlook Versio Thatch Outlook and VBA 2 July 13th 07 05:10 AM
how to see if a mail item has been deleted or not (in an IMAP folder) Christoph Guentner Outlook and VBA 1 January 25th 07 06:16 PM
I cannot empty deleted item in Outlook gary Outlook - Installation 3 April 24th 06 12:37 AM
Calendar Item Moved or Deleted Marcella Proust Outlook - Calandaring 1 April 19th 06 01:25 PM


All times are GMT +1. The time now is 10:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
MySpace Layouts - Quick Collect - Credit Cards - Cheap Car Insurance - Flights