NewFromSolution Does Not Cache Forms Correctly - Patrick Halstead
in

InfoPath Dev

Patrick Halstead

NewFromSolution Does Not Cache Forms Correctly

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 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.

Comments

No Comments

About Patrick Halstead

Hello! I am the founder of Qdabra Software, a small bootstrap software company focused on electronic forms for customers of all stripes. We help organizations design and implement solutions using off-the-shelf technologies such as Office 365, SharePoint and InfoPath. We help you build form solutions in the cloud or on premises. My hobbies include running, hiking, independent film, and Japanese culture.
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.