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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Items ItemAdd Outlook 2007 problem



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old July 31st 07, 08:40 AM posted to microsoft.public.outlook.program_addins
Luk[_2_]
external usenet poster
 
Posts: 5
Default Items ItemAdd Outlook 2007 problem

I wan't to have something like this:

I add items to Items collection and I do not wan't to handle the event (at
startup) and after I add some of those items I wan't to start handling the
ItemAdd event.

My code looks like this:

class Folder
{
private Outlook.Folder _folder = null;

private Outlook.Items _items = null;

private Logic.ContactsLogic _contactsLogic = null;

public Folder(Outlook.NameSpace outlook, string folderName)
{
Outlook.Folder defaultCalendarFolder =
(Outlook.Folder)outlook.GetDefaultFolder(Outlook.O lDefaultFolders.olFolderContacts);

_folder = GetFolder(defaultCalendarFolder, folderName);

_items = _folder.Items;

_contactsLogic = new ContactsLogic();

// In here I add some items to the folder
_contactsLogic.SynchronizeContacts(this);

HookUpEvents();
}


private void HookUpEvents()
{
_folder.BeforeFolderMove += new
Microsoft.Office.Interop.Outlook.MAPIFolderEvents_ 12_BeforeFolderMoveEventHandler(Folder_BeforeFolde rMove);
_folder.BeforeItemMove += new
Microsoft.Office.Interop.Outlook.MAPIFolderEvents_ 12_BeforeItemMoveEventHandler(Folder_BeforeItemMov e);
_items.ItemAdd += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemA ddEventHandler(Items_ItemAdd);
_items.ItemChange += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemC hangeEventHandler(Items_ItemChange);

_eventsHookedUp = true;
}
}

Although I add event handlers after I add the Items to the collection (in
statement _contactsLogic.SynchronizeContacts(this); ) I still get to handle
them in Items_ItemAdd and I don't wan't to
 




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
(VSTO SE) folder.Items.ItemAdd Event does not fire David Outlook and VBA 5 March 7th 07 08:41 PM
ItemAdd in Deleted Items event doesnt fire after a while [email protected] Add-ins for Outlook 11 January 8th 07 08:27 AM
ItemAdd in Deleted Items event doesnt fire after a while SHUperb Outlook - Calandaring 0 January 5th 07 07:41 AM
How to put the EventHandler ItemAdd to all open Deleted Items Folder's Ralf Preis Outlook and VBA 1 May 18th 06 04:35 PM
ItemAdd BlockNinja Outlook and VBA 1 March 23rd 06 04:49 AM


All times are GMT +1. The time now is 09:12 AM.


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.