Recover & make changes to InfoPath forms on SharePoint
Learn how you can recover an InfoPath form template if you still have access to a working InfoPath form in SharePoint, and then go about making changes to the form template.
Consider this scenario: You are a consultant and have been hired to make changes to an InfoPath form template that has been published to SharePoint. "No problem," you say. When you arrive at the customer, and ask to see the form template, they tell you that they don’t know what a form template is or where the former developer, who already left the company several months ago, put it. At this point, you start scratching your head and would like nothing else but to ask, "Then how am I supposed to make any changes?" But instead, you remain calm and say, "No problem! Can you please show me how you fill out forms in SharePoint?" At this point, they are most happy to show you, because they know what a form is and they know what they want changed on it, so they show you the way to their SharePoint...
Luckily in this case, you at least have a working InfoPath form to start with, so you know that there must be a form template somewhere to be found (otherwise the form would not be working), even if the developer did not document what he/she had done or where he/she stored the InfoPath form template's source files.
So where do you start? First you need to figure out what kind of InfoPath form it is. Is it a SharePoint List form or a SharePoint Form Library form? If the form is a SharePoint List form, it was published to a SharePoint list, otherwise it was published to a SharePoint form library. I'll keep workflow forms out of this discussion.
SharePoint List form templates are generally easier to modify, since they don't have code linked to them and they are always stored in a special folder that is part of the SharePoint list the form template was published to. You can open a SharePoint List form template either from within SharePoint or from within InfoPath Designer 2010 and then apply changes to it as you normally would to any other form template.
SharePoint Form Library form templates can be published in one of three ways:
- Directly to a SharePoint form library.
- As a SharePoint site content type.
- As an administrator-approved form template.
But here is the secret: In all cases, you would be creating a content type for the form template. So the clue is: Analyze the content type used for the InfoPath form, and you should be able to find the InfoPath form template that was last published. In InfoPath 2010 Cookbook 2 and InfoPath 2013 Cookbook 2 I already explained the connection between content types and InfoPath form templates, so won't go into details here.
Note that form templates published as site content types or administrator-approved form templates are usually stored in SharePoint document libraries. For the latter, the document library would be the Form Templates document library on the top-level site in the SharePoint site collection.
Once you have found or recovered a copy of the form template that was published, the next step would be to figure out whether code was written for the form template. If code was written and the customer cannot provide you with a project file or raw source code, then you're out of luck and will have to rewrite the code, since only compiled code is published along with the form template; no source code.
There are 3 ways you can find out whether code was written for a form template:
- Guess by looking at functionality provided by the InfoPath form (you'll need to be an experienced InfoPath developer for this).
- In InfoPath, click Developer > Code > Language and then check whether the Remove Code button is enabled (if it is, code was written for the form template).
- In InfoPath, click Data > Rules > Rule Inspector and if the message "InfoPath cannot retrieve the Visual Basic or C# programming information. The Visual Basic or C# project for this form template cannot be found. To locate the project yourself, click Browse." appears, code was written for the form template.
Once you have performed all of the steps mentioned above, you can just open the recovered InfoPath form template in InfoPath Designer 2010 and make changes like you normally would to any other form template.
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.