Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

Automating the Deployment of an Office InfoPath Form Template

Added 31 Jul 2008

When moving a form template to a new location, there are a number of items within the form template component files that need to be changed, such as the publishUrl in the manifest.xsf file. While you could do this within the InfoPath design mode, it is often more convenient and safer to use a script to modify these properties. In general, the following list represents the most common items that you may need to change:

  • The publishUrl
  • The wsdlUrl and serviceUrl of the Web service adapters
  • Database connection strings and other Data Connection parameters
  • The caption for the name of the form template
  • The form template URN

It is not necessary to modify all of these attributes for every form template deployment. In most cases, the script used to deploy a particular form template contains specific information about the form template itself, and where it is deployed.

Modification of the Processing Instructions (PI) in the template.xml file, which represents the default data for the form template, may also be necessary to avoid the conflict resolution dialog box when opening forms of the same name and version. This article does not address this specific issue, but the script could be modified to open this file and update the PI. For example code that provides a similar operation, refer to the SolutionFileModify, SolutionFileModifyVersion, and SolutionVersionUpdate functions in the xdown.js script code. This code file is used for the Downlevel Tool and can be found at Using the Downlevel Tool.

Using XsnFixup.js

The XsnFixup.js script contains 10 functions that enable you to unpackage a form template (.xsn) file, modify the manifest.xsf file, repackage the form template, and save it to a new location. The full script is included at the end of the article. Copy and paste this code into a script editor or Notepad, and save it as xsnfixup.js.

The Microsoft Cabinet Software Development Kit (SDK) files and folders should be present in the same location where you save the script file, namely, in a containing folder called "CabSDK".