E
educos
Hi,
I have a directory with some XML files that where saved by a template form
in InfoPath.
In this template I defined some rules (validation).
I want to write a little program in C# that open each XML file with Infopath
and verify that all rules are respected.
I tried these following lines:
using Microsoft.Office.Interop.InfoPath;
....
ApplicationClass app = new ApplicationClass();
XDocument form = app.XDocuments.Open(@"MyForm1.xml",
(int)XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
ErrorsCollection ec = form.Errors;
int nCountErrors = ec.Count
app.Quit(false);
but, when I try to get the Errors property, I get "Invalid cast exception".
Any idea of this problem ?
Perhaps I am wrong in the way to do the thing, thanks for any others ideas.
Regards.
Eric.
I have a directory with some XML files that where saved by a template form
in InfoPath.
In this template I defined some rules (validation).
I want to write a little program in C# that open each XML file with Infopath
and verify that all rules are respected.
I tried these following lines:
using Microsoft.Office.Interop.InfoPath;
....
ApplicationClass app = new ApplicationClass();
XDocument form = app.XDocuments.Open(@"MyForm1.xml",
(int)XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
ErrorsCollection ec = form.Errors;
int nCountErrors = ec.Count
app.Quit(false);
but, when I try to get the Errors property, I get "Invalid cast exception".
Any idea of this problem ?
Perhaps I am wrong in the way to do the thing, thanks for any others ideas.
Regards.
Eric.