SharePoint, InfoPath & an infamous "properties.xfp" file...?

For anyone who is not aware, when you publish a form from InfoPath to a SharePoint Forms Library and promote fields from this form, these promoted fields become columns within that Forms Library. Promoted Fields can be published as "Content Types" as well but that is outside of the scope and context of this blog so I will not get into that right now.

I recently worked a case where my customer was reporting that at random, 4 columns were just disappearing from their Form Library. At first we were not able to indentify any particular event, rhyme or reason as to why these same four columns would just magically go away, until one day they were asked to create a list template of this Form Library and send it to us. After this task was done, they noticed the 4 columns were now gone. I now had the "ListTemplate.stp" file in my possession and thought that since the columns were present at the time of the list template creation that if I created a new form library based on this list template, the columns should be present in my newly created list, however; when the new library was created from this list template, these 4 columns were not there. If you are not familiar with a "listtemplate.stp" file, you can actually rename the file from a .stp to a .cab file and then extract the contents of the file. Within any .stp file, you will find a manifest.xml file that has all the definitions of the contents of that library. In my case, I decided to dig into that manifest.xml file. When I looked at the file, I saw all the attributes of the columns that should be in my library, but were not present when I created a list from this template. I thought this was rather bizarre until I continued digging into this manifest.xml file and found a reference to a "properties.xfp" file. I decided to look into this file and I opened my form library with SharePoint Designer. I opened this properties.xfp file and discovered that the exact columns that were appearing in my library after saving the list as a template were the columns being defined within this "xfp" file.

The "xfp" file is a file that gets created when you publish a form with InfoPath 2003 and promote fields. InfoPath makes a call to the "owssvr.dll" and pushes the file through commands via that dll. Come to find out that my customer did originally create and publish the form within InfoPath 2003 and then later down the line, upgraded to InfoPath 2007 and promoted addtional fields and then re-published the form from an InfoPath 2007 client. InfoPath 2007 handles promoted fields and column creation a bit different than InfoPath 2003 client does. It simply makes web service calls through an asmx page that checks to see if columns exist or not and then creates/deletes columns based on the web service calls to the sharepoint library. InfoPath 2007 never touches or updates this "properties.xfp" file. So new fields within InfoPath 2007 that had been created and published will go out and create the new columns. The problem you run into when you originally publish a form from InfoPath 2003 and and then you come behind that work and re-publish and promote addtional fields with an InfoPath 2007 client, is that sharepoint will still look at this "xfp" file as a field definition solution and update its list's columns based on these fields within this file. Evidently when you save a list as a template, this is an event that triggers sharepoint to read this file and redefine it's list columns per this "xfp" file.

So you ask... 

How Can I fix this? Do I have to keep track of every promoted field and update this "xfp" file...?

To answer that, we need to ask a couple questions as well....

Will InfoPath 2003 client continue to be used to publish forms or will it strictly be InfoPath 2007 client publishing forms?

- If InfoPath 2007 will the only client used from this point on, you can simply browse to your forms library and delete the "properties.xfp" file. This will have no negative ramifications on your current list. To delete this file, you can do it with Windows Explorer View so that you do not have to install SharePoint Designer.

Actions:

1. Browse to the Library that contains this properites.xfp file.

2. From the “Action” menu, select Open in Windows Explorer

3. Once the window opens, browse into the “forms” folder

4. Locate the properties.xfp file

5. Delete it.

6. Close window and then browse back to the list settings

7. Now.. you can save the List as a Template

8. Once this is saved you can browse back to the list and should see the columns still intact.

9. Also create a new list based off this template to confirm that all columns are still intact.

- If InfoPath 2003 is still used in your environment then my recommendation would be to continue publishing the form with InfoPath 2003 until you are ready to make the change to InfoPath 2007

There is still a bit of investigation from a SharePoint Admin standpoint that I want to do but I wanted to share this for now in the event that any one experiences "columns" randomly disappearing from their sharepoint library and how you may want to look at the "properties.xfp" to see if this file exists in your library..

Chances are this is your culprit....