Question

I'm implementing an Office Add-in for Outlook 2010 and I want to perform some initialization when the user clicks on "New Appointment" (before the windows appears). What's the best way to know the user clicked only the New Appointment option. I tried this code:

var inspectors = this.Application.Inspectors;
inspectors.NewInspector +=
        new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

but it fires before every new item is created, and I only need to do it when an Appointment is created.

Was it helpful?

Solution

When NewInspector event fires, use Inspector.CurrentItem to retrieve the item being edited. You can use MessageClass or Type property (all items expose these properties) or use "is" operator to make sure you are only dealing with the AppointmeentItem objects.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top