J
jsmith
Hello,
I'm trying to develop a C# VSTO 2005 SE Outlook Addin. My add-in is
based on the OutlookEvents VSTO Sample. I am trying to capture Inbox
ItemAdd events. What I am finding is that this works on my
development machine, but the event handler function is never called
when I deploy it to a test client machine. The addin is being loaded
on the client machine, I put a message boxes in the EventTracker
constructor before and after the ItemsEvents_ItemAddEventHandler is
added to inbox.ItemAdd. These message boxes are displayed on the
client machine. However, when a message arrives in the inbox, the
handler never executes.
I don't think this is the scope problem that I've read about in so
many threads where the Outlook.Items variable is local to a function
and goes out of scope. I have
public static Outlook.Items _inboxItems;
in my EventTracker class. In the EventTracker constructor, I have:
Outlook.NameSpace mapiNamespace = app.GetNamespace("MAPI");
Outlook.MAPIFolder inbox =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.MAPIFolder;
_inboxItems = inbox.Items;
_inboxItems.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(InboxFolderItemAdded);
When I run this in the debugger on my development machine, the
InboxFolderItemAdded() function is called for every new message that
arrives in the inbox. When I run it on the test client,
InboxFolderItemAdded() is never called. Specs of my two systems
follow:
Dev Box:
Windows XP
Office 2003 SP2
Office 2003 PIA
VS 2005
VSTO 2005 SE
VSTO 2005 SE Runtime
Test Client:
Windows XP
Office 2003 SP2
Office 2003 PIA
VSTO 2005 SE Runtime
I did find this one msdn blog entry that suggests the Outlook.Items
member needs to be declared as public static:
http://blogs.msdn.com/jongallant/archive/2004/10/19/244820.aspx
However, I did this and it hasn't had any effect. Does anyone have
any insight about what I might be doing wrong here?
I'm trying to develop a C# VSTO 2005 SE Outlook Addin. My add-in is
based on the OutlookEvents VSTO Sample. I am trying to capture Inbox
ItemAdd events. What I am finding is that this works on my
development machine, but the event handler function is never called
when I deploy it to a test client machine. The addin is being loaded
on the client machine, I put a message boxes in the EventTracker
constructor before and after the ItemsEvents_ItemAddEventHandler is
added to inbox.ItemAdd. These message boxes are displayed on the
client machine. However, when a message arrives in the inbox, the
handler never executes.
I don't think this is the scope problem that I've read about in so
many threads where the Outlook.Items variable is local to a function
and goes out of scope. I have
public static Outlook.Items _inboxItems;
in my EventTracker class. In the EventTracker constructor, I have:
Outlook.NameSpace mapiNamespace = app.GetNamespace("MAPI");
Outlook.MAPIFolder inbox =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.MAPIFolder;
_inboxItems = inbox.Items;
_inboxItems.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(InboxFolderItemAdded);
When I run this in the debugger on my development machine, the
InboxFolderItemAdded() function is called for every new message that
arrives in the inbox. When I run it on the test client,
InboxFolderItemAdded() is never called. Specs of my two systems
follow:
Dev Box:
Windows XP
Office 2003 SP2
Office 2003 PIA
VS 2005
VSTO 2005 SE
VSTO 2005 SE Runtime
Test Client:
Windows XP
Office 2003 SP2
Office 2003 PIA
VSTO 2005 SE Runtime
I did find this one msdn blog entry that suggests the Outlook.Items
member needs to be declared as public static:
http://blogs.msdn.com/jongallant/archive/2004/10/19/244820.aspx
However, I did this and it hasn't had any effect. Does anyone have
any insight about what I might be doing wrong here?