E
educos
Hi,
I want to verify that a set of XML forms issued from an Infopath 2007
template respect all rules that has been defined in this template (because a
user can force saving a form even if it does not respect rules)
I do that by looping into all XML, loading the form in InfoPath and test the
Errors property of the XDocument...but problems occur when I try to access
the Errors property. Below is the code. Where am I wrong ?
using Mcrosoft.Office.Interop.Infopath
....
ApplicationClass app = new ApplicationClass();
XdDocumentVersionMode mode = XdDocumentVersionMode.xdCanOpenInReadOnlyMode;
int numMode = (int)mode; // =8
XDocument form = app.XDocuments.Open(@"MyForm.xml", numMode); // ==> ok, I
can see the form opened in Infopath
ErrorsCollection ec = form.Errors; // ==> "Invalid cast exception" !!!!
int countErrors = ec.Count;
app.Quit(false);
Thanks for your help
Regards.
Eric
I want to verify that a set of XML forms issued from an Infopath 2007
template respect all rules that has been defined in this template (because a
user can force saving a form even if it does not respect rules)
I do that by looping into all XML, loading the form in InfoPath and test the
Errors property of the XDocument...but problems occur when I try to access
the Errors property. Below is the code. Where am I wrong ?
using Mcrosoft.Office.Interop.Infopath
....
ApplicationClass app = new ApplicationClass();
XdDocumentVersionMode mode = XdDocumentVersionMode.xdCanOpenInReadOnlyMode;
int numMode = (int)mode; // =8
XDocument form = app.XDocuments.Open(@"MyForm.xml", numMode); // ==> ok, I
can see the form opened in Infopath
ErrorsCollection ec = form.Errors; // ==> "Invalid cast exception" !!!!
int countErrors = ec.Count;
app.Quit(false);
Thanks for your help
Regards.
Eric