locked
Hookup to Outlook 2007 Appointment events. RRS feed

  • Question

  • User-858167860 posted

    Hello,

    I trying to hookup to Outlook 2007 events and listen to new Appointment added event.
    The idea is to create a new Appointment from Outlook and to capture the event by my code.
    Here's me code:

    Application app = new Microsoft.Office.Interop.Outlook.Application();
    NameSpace ns = app.GetNamespace("mapi");
    ns.Logon(Missing.Value, Missing.Value, true, true);
    
    //Get the calendar forlsr
    MAPIFolder calendar = ns.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
    
    //Get all appointments
    Items appointments = calendar.Items;
    
    //Hookup to events
    appointments.ItemAdd += new ItemsEvents_ItemAddEventHandler(appointments_ItemAdd);
    appointments.ItemChange += new ItemsEvents_ItemChangeEventHandler(appointments_ItemChange);
    appointments.ItemRemove += new ItemsEvents_ItemRemoveEventHandler(appointments_ItemRemove);
    
    void appointments_ItemAdd(object Item)
    {
    	
    }
    


    When i creating a new Appointment from Outlook 2007 the event is not fireing to appointments_ItemAdd method.

    I appretiate any help.

    Tuesday, March 10, 2009 3:51 AM

All replies

  • User-858167860 posted

    The following should be a class member:

     

    Items appointments
      
    Tuesday, March 10, 2009 8:09 AM