Thursday 21 January 2010

Side-By-Side Versioning of InfoPath Browser Based Forms using SharePoint 2007 (aka how to have Multiple versions the same Form in the Same Forms Library)

When you have an InfoPath form live on your server, and you make a change to the schema of the form and upload it over the existing copy, your old forms won't open. You will just get a "Form has been closed" message or another kind of supporting error. To avoid killing off old versions of forms when deploying new versions, you simply have to do the following:
  1. Publish the form with a new name e.g. PurchaseOrderForm_V1-01.xsn using the Publish wizard either in InfoPath of Visual Studio 2008. Note that you cannot just publish and rename it as this will not change the FormId and instead potentially upgrade all your old forms to an incompatible version.

  2. Upload the file to the server via Central Admin > Applications Management > Upload Form Template
  3. Activate the form to your site collection. Look at the properties of the form from the Central Administration > Application Management > Manage Form Templates > View Properties - it should have the version in the form Id (e.g. urn:schemas-microsoft-com:office:infopath:PurchaseOrderForm-V1-01:-myXSD-2009-11-02T03-05-56)
  4. Go to My Form Library (e.g. "Purchase Order Forms" > Settings > Form Library Settings. Where the current content type is used.
  5. Add the new content type PurchaseOrderForm_V1-00 to the list.

  6. Rename the old Content Type (ie the current one in use that you want to preserve) to PurchaseOrderForm_V1-00 (this is typically the Name of the "Parent content Type"
  7. Rename the newly uploaded content type from PurchaseOrderForm_V1-00 to a friendly name the same as the old version e.g. "Purchase Order Form"

  8. Go to "Purchase Order Forms" > Settings > Form Library Settings > Change New Button Order and Default Content Type
  9. Hide the old content type as you don't want new instances created (e.g. hide "PurchaseOrderForm_V1-00") and show the new version "Purchase Order Form". It should be selected as the default content type.
  10. Finished - old versions of your form will still open without error and appear as they used to, and the new versions will open with the updated code base and schema.

    Also See which has similar info. I also confirmed that this works if your Forms reference common code Dlls - the assemblies required for the forms are also not blown away as you are not upgrading.

1 comment:

kelder said...

Does this versioning procedure also apply to SP 2010? I'd like multiple versions available, but the steps don't match what I see in SP 2010.

I see and existing template in the 'Template URL box' in the 'Advanced settings' page that was deployed via an initial Publish, but should I specify the newly versioned template that was uploaded?