A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

ItemAdd event with Outlook2007



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 4th 06, 12:08 AM posted to microsoft.public.outlook.program_forms
Fidget Brain
external usenet poster
 
Posts: 8
Default ItemAdd event with Outlook2007

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



  #2  
Old July 4th 06, 09:29 AM posted to microsoft.public.outlook.program_forms
DavidH&P
external usenet poster
 
Posts: 16
Default ItemAdd event with Outlook2007

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




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 12:54 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-2025 Outlook Banter.
The comments are property of their posters.