Items events not fired

  • Thread starter Thread starter Cedric
  • Start date Start date
C

Cedric

Hello all,

As I've already read about this issue, I know the title of my post may have
made you grin.
My add-in needs to track the activity of some folders. I know that under
certain conditions, the Items events may not fire. This is why, in order to
avoid my objects references getting eaten by the GC, I have:
- recursively created a tree of objects named QFolderWatcher, whose purpose
is to watch the activity of the outlook folders tree (or at least part of the
tree)
- included 2 variables in this class, named MyFolders and MyItems. When
creating a new QFolderWatcher, I save in a private variable the MAPIFolder,
and then put (VB):
MyFolders = Folder.Folders
MyItems = Folder.Items

Both variables are declared WithEvents, and all my objects have cross
references with:
- QFolderWatcher.SubFolders =list(of QFolderWatcher) : the list of
QFolderWatchers watching the current folder's subfolders
- QFolderWatcher.Parent : the FolderWatcher that watches the MAPIFolder's
parent folder.

The strange thing is that both variables MyFolders and MyItems are created
and initialized at the same place, and my application receives events from
the folders, but nothing about its items.
 
As you know, almost all the time this happens it's due to out of scope
objects or objects that have been garbage collected. No exceptions in your
code and if you step the code everything is instantiated and not Nothing?

Have you tried simplifying the code to handle only one folder and one Items
collection to make sure that works with how you're doing things?

What version of Outlook? What version of the PIA are you referencing? What
version of VS?

What code are you using, show a small piece that someone can look at for
your instantiations and for your adding event handlers and your event
handler signatures.
 
Hi Ken,

thanks for your help and sorry for bothering : the issue is actually closed.
A condition that never happened to be true, plus a mess in version management.
Events are fired correctly now. Thanks anyway!

Ced
 
Back
Top