How to publish an InfoPath form

In a previous post, I already briefly touched on how to publish an InfoPath form to a SharePoint 2007 server.

However, there is much more to it. In this post, I dive into the details.

Here are the main steps one has to follow.

  1. Under the assumption you make a change to an existing form template: create a local copy of the InfoPath form you need to change. Right click the form template and say “Design”. Then make your changes. If there’s custom code in it, fire up Visual Studio for Applications.  Rebuild the code.
  2. Create a published version of the form. Click “File > Publish”.
  3. Follow the Publishing Wizard.  Select “To a SharePoint server without InfoPath Forms Services” ((You can also publish the form template to a SharePoint library. It will then be regarded as a new content type.  However, this will allow users to publish new version of the forms if they have access. If you publish the form template to an Infopath Forms  Service, you can approve it by an administrator and retain control)).
  4. Enter the location of your Sharepoint or InfoPath Forms Services site.
  5. Click “Enable this for, to be filled out by using a browser” if required.
  6. Also select the radio button “administrator-approved” to prepare this form template for an administrator approval.
  7. Publish the new form and place the form template in a shared location.
  8. SharePoint farm administrator has to go to “Central Admin” and then “Application management”.
  9. SharePoint farm administrator has to browse to InfoPath form services and upload the form template from the shared location.
  10. “upgrade the form template if already exists” needs to be unchecked if it is a new form.
  11. VERIFY button needs to be clicked and SharePoint farm administrator has to report error messages on the template.
  12. On the “manage form templates” page, the deployment engineer has to activate the new form template to a site collection in a web application.
  13. The new form can be found by going through “Site Actions” > “View all site content”. The form template is stored in the document library “Form Templates”. You can then enable the form on a Page by adding a PageViewer Web Part.

Errors

There are several errors one can encounter when trying to publish an InfoPath form template.

Uploading form

Two common errors you may encounter when trying to upload the form in the central administration: one is if you do not check “upgrade existing form template”. The other one is in the other scenario: when trying to upgrade an existing form template.

  1. Below error means that there is already a form deployed with the same schema. Renaming the InfoPath form does not help. The only solution is to copy paste the form in a new template. Or you can delete the form(s) with the same schema from the template server if that’s an option.
    Form with the same identity urn:schemas-microsoft-com:office:infopath:example:-myXSD-2011-09-06T12-36-26 is already deployed on this farm. at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.TryAdd(String path, Guid featureId, String featureName, ConverterLog& converterLog)
    at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.TryAdd(String path, ConverterLog& converterLog)
    at Microsoft.Office.InfoPath.Server.ApplicationPages.UploadFormTemplatePage.<>c__DisplayClass1.b__0(String sourceName)
    at Microsoft.Office.InfoPath.Server.ApplicationPages.UploadFormTemplatePage.HandleFiles(HandleFile fileHandler)
    at Microsoft.Office.InfoPath.Server.ApplicationPages.UploadFormTemplatePage.ButtonOkClick(Object sender, EventArgs e)
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  2. When you try to upgrade an existing form template, you cannot  rename the form template.  Otherwise you will run into the below error.
    The form template cannot be upgraded because the file name has changed since the previous version. Rename the file name to the following or change the form ID of the form template: form template.xsn   at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.TryUpgradeFormTemplate(String solutionPath, UpgradeType upgradeType, ConverterLog& converterLog)
    at Microsoft.Office.InfoPath.Server.Administration.FormTemplateCollection.UpgradeFormTemplate(String solutionPath, UpgradeType upgradeType)
    at Microsoft.Office.InfoPath.Server.ApplicationPages.UploadFormTemplatePage.<>c__DisplayClass1.<ButtonOkClick>b__0(String sourceName)
    at Microsoft.Office.InfoPath.Server.ApplicationPages.UploadFormTemplatePage.HandleFiles(HandleFile fileHandler)
    at Microsoft.Office.InfoPath.Server.ApplicationPages.UploadFormTemplatePage.ButtonOkClick(Object sender, EventArgs e)
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Data Connections

Another nasty error that I ran into is when working with data connections.

Data connections allow you to retrieve or push data to a location. There are different types of data connections.

  1. SharePoint lists: popdown lists to select values from a (custom) SharePoint list.
  2. Support XML file: can be used in a repeating table to find products based on a certain business unit, for example. You can run some XPath query against it.
  3. Data connections to e-mail
  4. SharePoint Library Submit: Data connection to submit to a SharePoint Library ((Possible constraint might be that only users that are member of a certain group are allowed to store the InfoPath forms in the libraries. ))

It is very important that you ensure that all data connections referring to a SharePoint list, are linked to the same SharePoint server as where the InfoPath form is published. There is no mismatch allowed! InfoPath form servers simply cannot recognize SharePoint lists in another domain/server. Thus, this really differs for testing, pre-production and production environments! Be careful, you might overlook this like I did. The error cannot be found in the server’s event viewer either.

More: an error occurred when accessing the data source.

One thought on “How to publish an InfoPath form”

Leave a Reply

Your email address will not be published. Required fields are marked *