P
Patrick Halstead
This is a problem I came across last week.
If you have a form A that opens another form B using
NewFromSolutionWithData, and form B has not previously been used (i.e.
cached), then InfoPath will cache it incorrectly resulting in errors when
form B tries to open a file.
Steps to repro:
1.. Create a jscript Form A with the following code attached to a button
OnClick event handler:
var oXDoc =
Application.XDocuments.NewFromSolutionWithData(XDocument.DOM.documentElement
, sSharePointTemplate, 1);
where sSharePointTemplate refers to the xsn in your form library, for
example:
http://sharepoint.company.com/name/Forms/template.xsn
2.. Create a managed code Form B using the same schema as in form A with a
button that loads a file from the form library. For example:
thisApplication.XDocuments.Open(sForm,
(int)XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
where sForm points to the location of the file, for example:
http://sharepoint.company.com/name/foo.xml
3.. Publish Form B to the form library that you use for the
sSharePointTemplate parameter above. I.e., publish to:
http://sharepoint.company.com/name/
4.. Open Form A and click the button to run the code.
5.. Form B should open automatically. Click on the button.
Result: error. This is the same error that is documented at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;823436
However, I think it's a different problem.
Q: Why do I care about this scenario?
A: If you have a split solution to handle workflow between offline forms and
online collaboration, you might want to do this since RegForm removes the
publishURL and and digital certificates are costly to install (see previous
post).
Q: How do I workaround this problem?
A: The easiest thing is to navigate to Form B's form library and click "Fill
Out This Form" before running Form A. Then Form B is cached with the correct
settings.
Patrick Halstead
InfoPath MVP
http://www.infopathdev.com/blog/PermaLink.aspx?guid=9fc31c95-201f-44a1-938b-a8d9cf47d5e5
If you have a form A that opens another form B using
NewFromSolutionWithData, and form B has not previously been used (i.e.
cached), then InfoPath will cache it incorrectly resulting in errors when
form B tries to open a file.
Steps to repro:
1.. Create a jscript Form A with the following code attached to a button
OnClick event handler:
var oXDoc =
Application.XDocuments.NewFromSolutionWithData(XDocument.DOM.documentElement
, sSharePointTemplate, 1);
where sSharePointTemplate refers to the xsn in your form library, for
example:
http://sharepoint.company.com/name/Forms/template.xsn
2.. Create a managed code Form B using the same schema as in form A with a
button that loads a file from the form library. For example:
thisApplication.XDocuments.Open(sForm,
(int)XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
where sForm points to the location of the file, for example:
http://sharepoint.company.com/name/foo.xml
3.. Publish Form B to the form library that you use for the
sSharePointTemplate parameter above. I.e., publish to:
http://sharepoint.company.com/name/
4.. Open Form A and click the button to run the code.
5.. Form B should open automatically. Click on the button.
Result: error. This is the same error that is documented at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;823436
However, I think it's a different problem.
Q: Why do I care about this scenario?
A: If you have a split solution to handle workflow between offline forms and
online collaboration, you might want to do this since RegForm removes the
publishURL and and digital certificates are costly to install (see previous
post).
Q: How do I workaround this problem?
A: The easiest thing is to navigate to Form B's form library and click "Fill
Out This Form" before running Form A. Then Form B is cached with the correct
settings.
Patrick Halstead
InfoPath MVP
http://www.infopathdev.com/blog/PermaLink.aspx?guid=9fc31c95-201f-44a1-938b-a8d9cf47d5e5