Sandun Dav Frank
Posts: 13
Joined: 2016-03-30
|
I am checking every _InspectorClose event to check All required fields are filled in the inspector.
If required fields not filled I want to show message box and stay the inspector without closing.
private void adxAppEvents_InspectorClose(object sender, object inspector, string folderName)
{
try
{
Outlook.Inspector ins = OutlookApp.ActiveInspector();
Outlook.MailItem mail = null;
Outlook.AppointmentItem appointment = null;
Outlook.ContactItem contact = null;
if (ins != null)
{
item = ins.CurrentItem;
if (item != null)
{
if (item is Outlook.MailItem)
{
mail = item as Outlook.MailItem;
}
else if (item is Outlook.AppointmentItem)
{
appointment = item as Outlook.AppointmentItem;
}
else if (item is Outlook.ContactItem)
{
contact = item as Outlook.ContactItem;
}
if (contact != null)
{
RequiredFields requiredObj = new RequiredFields();
if (!requiredObj.RequiredFieldsFilled())
{
//Show Messagebox
//Inspector not close
}
}
}
}
}
}
catch (Exception ex)
{
Debug.DebugMessage(2, "Error in adxAppEvents_InspectorClose " + ex.Message);
}
finally
{
if(item != null)Marshal.ReleaseComObject(item);
}
}[CODE] |
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
|
Sandun Dav Frank
Posts: 13
Joined: 2016-03-30
|
HI Andrei ,
Thanks for the quick reply. So you mean is there no any method to exit the _InspectorClose event. And inspector not close if the condition passed.
Is it possible we open again that inspector inside the
if (!requiredObj.RequiredFieldsFilled()) .
And it is not any harm to performance of the plugin?
(I just need to if messageBox popup not closing the inspector) |
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Hello Sandun,
There's no way to cancel the InspectorClose event; that is, you can't use this event to prevent the inspector form closing.
Sandun Dav Frank writes:
Is it possible we open again that inspector
Note that an inspector contains a visual representation of an item (e.g. MailItem, ContactItem, etc.) To reopen an inspector means to call MailItem.Display.
Andrei Smolin
Add-in Express Team Leader |
|