Search code examples
outlookadd-inribbon

CurrentItem Method is not working on my inspector


I'm creating a Ribbon with a splitbutton which automaticly fills the subject line on an appointmentitem, but I can't seem to do that without creating a new Item. I don't want another window of the calendar to open, I want to use the current one I already opened. Here is my code so far for the splitbutton:

Outlook.Inspector inspector = Globals.TerminAddIn.Application.ActiveInspector();     
       Outlook.AppointmentItem appointmentItem = inspector.CurrentItem(); 
       appointmentItem.Subject = "Test" ; 


Solution

  • It's called when I click on the SplitButton. I already fixed the problem though.

    var inspector = Globals.TerminAddIn.Application.ActiveInspector().CurrentItem;
            Outlook.AppointmentItem appointmentItem = inspector;
            appointmentItem.Subject = "Test123"; 
    

    That`s how it´s working now.