ItemRemove event does not recieve needed parameter

M

Mark J. McGinty

I'm processing contact item events by declaring a variable as such:

Public WithEvents m_ContactItems As Outlook.Items

And initializing it like this:

Set m_ContactItems =
Outlook.Application.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts).Items

That all works fine, except that as I just went to add an ItemRemove
handler, I saw that, unlike ItemAdd and ItemChange, ItemRemove does not
receive an Item parameter when it's called. What gives? How do I determine
which item is being deleted?

tia,
Mark
 
K

Ken Slovak - [MVP - Outlook]

There is no real way to get that information. You can try trapping ItemAdd
on the Deleted Items folder's Items collection but that won't trap items
that are hard deleted (Shift+Delete). The only real way is to set up a
collection of items in the folder and compare that collection to the
existing Items collection and seeing what's missing after ItemRemove fires.
It's a hack but that's about all you can do.
 

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