G
G. Tarazi
So simple,
Have an InfoPath form / C# code.
Have a taskpane HTML + JavaScript
Have an event handler "on after change" on a node in the schema.
Have the event handler closing the form on the "Insert" even type using this code:
thisXDocument.SetDirty(false);
thisXDocument.View.Window.Close(true);
And you will get this error message:
System.Runtime.InteropServices.COMException
Invalid context for OM call.
at Microsoft.Office.Interop.InfoPath.SemiTrust.Window.Close(Boolean fForce)
at Microsoft.Office.Interop.InfoPath.SemiTrust.WindowObjectWrapper.Close(Boolean fForce)
at Microsoft.Office.Interop.InfoPath.SemiTrust.WindowObjectWrapper.Close(Boolean fForce)
at ..............ClientProfile.CreditWorkflow.DistributeCreditLmApply() in ......................
And I am realizing later, after losing half a day on this unnecessary issue, that InfoPath will give you a similar error when you try to switch the view during the after change event.
So once up on a time, there was someone from InfoPath, who decided that views must trigger errors if touched during the "after change event" that is triggered because of the taskpane.
I Wakeup every morning telling my self, Georgeyyyyy, be positive today, until I find one of these unnecessary restrictions, designed simply to waste your time, and I am negative again
:-| :-(
And as a result, the InfoPath taskpane is incapable of asking InfoPath to perform something, and then close the form.
Have an InfoPath form / C# code.
Have a taskpane HTML + JavaScript
Have an event handler "on after change" on a node in the schema.
Have the event handler closing the form on the "Insert" even type using this code:
thisXDocument.SetDirty(false);
thisXDocument.View.Window.Close(true);
And you will get this error message:
System.Runtime.InteropServices.COMException
Invalid context for OM call.
at Microsoft.Office.Interop.InfoPath.SemiTrust.Window.Close(Boolean fForce)
at Microsoft.Office.Interop.InfoPath.SemiTrust.WindowObjectWrapper.Close(Boolean fForce)
at Microsoft.Office.Interop.InfoPath.SemiTrust.WindowObjectWrapper.Close(Boolean fForce)
at ..............ClientProfile.CreditWorkflow.DistributeCreditLmApply() in ......................
And I am realizing later, after losing half a day on this unnecessary issue, that InfoPath will give you a similar error when you try to switch the view during the after change event.
So once up on a time, there was someone from InfoPath, who decided that views must trigger errors if touched during the "after change event" that is triggered because of the taskpane.
I Wakeup every morning telling my self, Georgeyyyyy, be positive today, until I find one of these unnecessary restrictions, designed simply to waste your time, and I am negative again
And as a result, the InfoPath taskpane is incapable of asking InfoPath to perform something, and then close the form.