Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Items events not fired (http://www.outlookbanter.com/add-ins-outlook/83237-items-events-not-fired.html)

Cedric December 15th 08 11:25 PM

Items events not fired
 
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.



Ken Slovak - [MVP - Outlook] December 16th 08 03:30 PM

Items events not fired
 
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.

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


"Cedric" wrote in message
...
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.




Cedric December 16th 08 04:42 PM

Items events not fired
 
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


All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com