You create an Office InfoPath form template and publish it to a document library in SharePoint. During publishing you select certain InfoPath Fields to be published as Columns in the document Library. After publishing the form template, you decide to publish the same Form Template and the same fields to a different document library on the same SharePoint site.
Later, you implement a change in the InfoPath Form Template and re-publish the Form Template to both the document Libraries in the same order as you did during the first publishing.
In this scenario, all the columns in the document Libraries that were published from InfoPath fields are recreated.
During this procedure, the internal name of the recreated columns in the SharePoint document libraries is also updated (i.e.) a numeric starting with '0' is suffixed to the old column name. For example; a column called LastName changes to LastName0.
- The recreation of the columns is a two-step process: First, the Column is added to the SharePoint Library again. Second, the columns which are not associated with the InfoPath fields are removed.
InfoPath stores the list of Fields that are published to SharePoint document libraries in a local manifest along with the columns which these fields are associated to. This is accomplished by referencing the column ID in SharePoint (a unique GUID value) with the InfoPath Field.
When you are publishing the updated InfoPath Form Template to a SharePoint document library the second time, InfoPath checks if the column with the associated ID already exists. If it does not find the corresponding column, a new column is created in the document library. Any columns that are not associated with any of the InfoPath fields are deleted from the document library.
The following operations are performed in the background when you publish the same Form Template to multiple SharePoint Libraries - When you publish the Form Template to the First Library the First Time, each published column gets created and is associated with the corresponding InfoPath Field. - When you publish the Form Template to the Second Library the First Time, InfoPath does not find the associated Columns with the stored IDs and hence creates new Columns. It then associates the new Column ID with the corresponding InfoPath Field. - When you publish the Form Template to the First Library the Second Time, InfoPath does not find the associated Columns with the stored IDs, as the GUIDs from the Second Library are currently associated with the Fields. So InfoPath creates new Columns which in turn get new IDs and are associated with the InfoPath Fields. - In this process, there are many columns created which are not associated with any of the InfoPath fields and are removed from the document library. - This behavior is repeated when you publish the Form Template to the Second Library the Second Time.
Note: This issue does not occur if the InfoPath Form Template is being published as a Site Content Type OR InfoPath Fields are being published as Site Columns in SharePoint.
There are a couple of methods to prevent this from happening: - Create a Site Column for each InfoPath Field to be published on the SharePoint site and select the pre-created Site Columns when publishing the InfoPath form template to both the libraries. As the ID of the Site Columns will not change, InfoPath does not have to re-create the existing columns. - Create a separate copy of the InfoPath Form Template, one for each of the SharePoint document libraries. This will ensure that InfoPath does not re-create the existing columns as the column IDs will not change. The disadvantage of this approach is that you need to implement all the changes in all the Form Template copies that are in use.
Note : In general instead of publishing the InfoPath Form Template twice, the recommended approach is to publish the Form Template as a Site Content Type and associate the Site Content Type with both the SharePoint document libraries.
InfoPath, SharePoint, Site Columns, Form Template, Fields