Adding property page to Outlook 2000 and up using C#

  • Thread starter Thread starter Paul Keeley
  • Start date Start date
P

Paul Keeley

How do you add a propery page to Outlook 2000 using C#? I tried adding the
event handler using the following code. It compiled fine but generated the
exception at the bottom.

try

{

applicationObject.OptionsPagesAdd += new
Outlook.ApplicationEvents_OptionsPagesAddEventHandler(this.OptionsPagesAdded
);

}

catch (Exception e)

{

System.Diagnostics.Debug.Write(e.ToString());

}


System.InvalidCastException: No such interface supported

at System.Runtime.InteropServices.UCOMIConnectionPoint.Advise(Object
pUnkSink, Int32& pdwCookie)

at
Outlook.ApplicationEvents_EventProvider.add_OptionsPagesAdd(ApplicationEvent
s_OptionsPagesAddEventHandler )

at
Outlook.ApplicationEvents_Event.add_OptionsPagesAdd(ApplicationEvents_Option
sPagesAddEventHandler )



Thanks,

Paul Keeley
 
I don't think 2000 has Primary Interop Assemblies so you may want to check
the ILDASM for the imported Outlook Object Model DLL to make sure that the
event you're trying to register for is marked public not private.

Tom
 
Back
Top