![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
try making the oItems field into a class scoped field rather than a local
scoped field. there is a known issue, where an event handler will not fire for a local scoped field, because it is getting garbage collected. "DavidH&P" wrote in message ... hi, can anyone help me to find what's wrong in my code ? I'm using VSTOv3 and Outlook2007 beta2, I try to use the ItemAdd event but any messageBox appear when i move a into the inbox folder or when a new mail arrives into this folder. ----------------------------- Outlook.NameSpace mapiNamespace = this.GetNamespace("MAPI"); Outlook.MAPIFolder inBox = (Outlook.MAPIFolder) this.ActiveExplorer().Session.GetDefaultFolder(Out look.OlDefaultFolders.olFolderInbox); Outlook.MAPIFolder oFolderSurveille = inBox; Outlook.Items oItems = oFolderSurveille.Items; oItems.ItemAdd += new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemA ddEventHandler(oItems_ItemAdd); private void oItems_ItemAdd(object Item) { MessageBox.Show("ItemAdd event"); } -------------------------------------- thanks, David |
#2
|
|||
|
|||
![]()
Thanks,
it solves my problem ! "Fidget Brain" wrote: try making the oItems field into a class scoped field rather than a local scoped field. there is a known issue, where an event handler will not fire for a local scoped field, because it is getting garbage collected. "DavidH&P" wrote in message ... hi, can anyone help me to find what's wrong in my code ? I'm using VSTOv3 and Outlook2007 beta2, I try to use the ItemAdd event but any messageBox appear when i move a into the inbox folder or when a new mail arrives into this folder. ----------------------------- Outlook.NameSpace mapiNamespace = this.GetNamespace("MAPI"); Outlook.MAPIFolder inBox = (Outlook.MAPIFolder) this.ActiveExplorer().Session.GetDefaultFolder(Out look.OlDefaultFolders.olFolderInbox); Outlook.MAPIFolder oFolderSurveille = inBox; Outlook.Items oItems = oFolderSurveille.Items; oItems.ItemAdd += new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemA ddEventHandler(oItems_ItemAdd); private void oItems_ItemAdd(object Item) { MessageBox.Show("ItemAdd event"); } -------------------------------------- thanks, David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
NewMailEx vs. ItemAdd | Mark Rae | Outlook and VBA | 14 | June 15th 06 04:07 PM |
Outlook2007 Can't select text | Jeff | Outlook - General Queries | 1 | June 7th 06 04:03 PM |
Error code for outlook2007 beta | Chen Xiao | Outlook - Installation | 7 | May 31st 06 07:03 PM |
How to put the EventHandler ItemAdd to all open Deleted Items Folder's | Ralf Preis | Outlook and VBA | 1 | May 18th 06 05:35 PM |
ItemAdd | BlockNinja | Outlook and VBA | 1 | March 23rd 06 05:49 AM |