views:

767

answers:

1

We have an ASP.NET application with an InfoPath forms component, delivering InfoPath forms to the browser using InfoPath Forms Server. Rather than save the forms in SharePoint, we submit the XML form data to a ASP.NET web service, which saves the data as an XML data type in SQL Server 2005. This is working fine, and we have no issues loading the XML data back into the InfoPath form.

Our issue comes when we try to load old data ( from Version 1 of the form) into a new version of the form (Version 2). This new version of the form (V2) has a new textbox field, for example. Because the V2 field does not exist in the V1 XML, they are visible on the V2 form, but are disabled and cannot be filled.

Our question is how do we load V1 XML data into V2 forms, and have the user be able to complete those fields which are now present in V2 of the form.

This behaviour is possible using InfoPath Forms Server and forms stored in a Form Library. if you update the Form Template, you can open old forms in the new template, see the new fields, and can save data in the new fields. We need to know how to do it programmatically when the Form XML data is stored in SQL Server, rather than a Form Library.

+1  A: 

It's been a while since I did anything InfoPath, so apologies for this being a little vague:

Part of the InfoPath template, which is pretty much just a ZIP archive with a different extension, is a file called "upgrade.xsl". This file contains one or more XSL transformations that "upgrade" documents targeting earlier schema versions.

The question is: Why does the correct transformation get applied in one scenario (SharePoint/Form Library) and not in the other (web service)? Is the second process possibly losing the tag that InfoPath uses to know the version of the schema that the source document is targeting? I believe the tag I'm referring to is the "?mso-infoPathSolution" tag ("solutionVersion" attribute).

If this tag is indeed being stripped from the document (and you can't easily prevent it), you may need to apply the appropriate XSL transformation "manually". Of course, if there are multiple versions you are dealing with, it could be difficult to determine what transformation needs to be applied in any case.

Daniel Pratt
The Upgrade.XSL is the element we've been missing - this must be called when InfoPath opens form data for a form older than the current version. Is there a way to obtain this XSL through the InfoPath object model, rather than extracting it manually and running a transform on the old data?
Eoin Connolly