3
votes

I have a need to display a custom form instead of the default inspector form for an outlook appointment item. I want to do this in C#.

There's a good tutorial on devx but it's using VB, and I want to use C#. So I've translated the code to C# and I'm having a problem where I need to override the Open event handler for the AppointmentItem (called mcAI). In the above mentioned tute, they say to do the following in VB:

Private Sub tyAI_Open(ByRef Cancel As Boolean) Handles tyAI.Open
    Cancel = True
End Sub

which to me translates as:

private void mcAI_Open(out bool Cancel)
{
    Cancel = true;
}

(Note I've tried this with and without an out and ref parameter, and with/without an object as the first param too)

However we need to register that this is a with the event, so I've put in this code:

mcAI.Open += 
    new Microsoft.Office.Interop.Outlook.ItemEvents_10_OpenEventHandler(mcAI_Open);

But I can't compile this as I get the error:

No overload for 'mcAI_Open' matches delegate 'Microsoft.Office.Interop.Outlook.ItemEvents_10_OpenEventHandler'

Any ideas on how I am supposed to register my function for the Open event of the AppointmentItem? Thanks in advance.

(BTW there's a MSDN QA which suggests my code should work and yet I'm still stuck.)

1

1 Answers

5
votes

Theoretically, this should work:

private void mcAI_Open(ref bool Cancel)
{
    Cancel = true;
}