views:

683

answers:

1

I'm developing an outlook addin that has a button in a custom task pane (thats in an inspector window). When its clicked, I'd like it to do something to the current active item (in my case, it's the appointmentItem). I've tried this (this code is in the custom task pane class):

    private void button1_Click(object sender, EventArgs e)
    {

        Outlook.Inspector inspector = (Outlook.Inspector)Globals.ThisAddIn.Application.ActiveInspector;
        Outlook.AppointmentItem appt = (Outlook.AppointmentItem)inspector.CurrentItem;
        appt.Body += "this is a test";
    }

but it through me this error: "Cannot convert method group 'ActiveInspector' to non-delegate type 'Microsoft.Office.Interop.Outlook.Inspector'. Did you intend to invoke the method?"

Thanks

+1  A: 

I think ActiveInspector is a method & not a property.

Try this
Outlook.Inspector inspector = (Outlook.Inspector)Globals.ThisAddIn.Application.ActiveInspector**()**;

shahkalpesh