View Single Post
  #1  
Old July 3rd 06, 08:19 PM posted to microsoft.public.outlook.program_forms
DavidH&P
external usenet poster
 
Posts: 16
Default ItemAdd event with Outlook2007

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

Ads