Nilaksha Perera
Nilaksha Perera

Reputation: 725

How to properly close active inspector in outlook 2010

I am trying to close a mail item (from its inspector) at Outlook mail item send event after cancelling the send action. How I'm trying to close the inspector is as following.

_Inspector currentInspector = _applicationObject.ActiveInspector();
 currentInspector.Close(OlInspectorClose.olSave);

However this causes Outlook to crash. How can I overcome this problem ? I'm testing this code in Outlook 2010.

Upvotes: 0

Views: 401

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66215

Crash as in access violation? Or a COM error? In the latter case, what is the error code and error description?

Keep in mind that some methods cannot be called from the ItemSend event. Use a timer: enable it in the ItemSend event handler, then in the timer event handler (you will be out of the ItemSend event by then), disable the timer and call Inspector.Close.

Upvotes: 1

Related Questions