The InfoPath story: chapter 1: The beginning

Situation: :

A project must be implemented with a lot of InfoPath forms (around 50), only problem is… InfoPath isn’t designed by default to be “deployable”. But a positive side is that there is no code behind in the InfoPath form, so only the form designer is used.

Also we have around 70 content types and around 400 fields, so a lot of stuff that needs to be done and implemented.

I’ll skip forward to the InfoPath designs and deployment.

If you are asking yourself the question, can an InfoPath form be deployed without going via the InfoPath form services, or a forms library… than the answer is yes…. but…

As I’ve previously said, InfoPath is not “deployable as a solution” by design. The xsn file is actually a cabinet file that contains multiple files.

explanation about the .xsn file from FileExt

The XSN file type is primarily associated with ‘InfoPath’ by Microsoft Corporation. InfoPath is the Microsoft Office information gathering and management program. The .XSN file is a kind of cabinet (CAB) file that contains additional parts and files. 

Also you cannot deploy InfoPath via the other 2 ways (InfoPath form services or via a forms library) because there are the content types to consider. And they are all connected via a certain hierarchy. If I would deploy the forms via any of the other ways that I loose that connection in the hierarchy and the content type would exist on it’s own.

OK: so we’ve set the scene, we know all possible outcomes and which way to follow… , this one is going to be bumpy.

Step 1: Create all the fields and content types first – content analysis

Step 2: let’s say that each content type has a list (to keep things simple)

you can add multiple content types to the list and via list settings –> Form settings you can select the content type and customize (or create) the InfoPath form

ListFormSettings

and in the form settings page you can select the content type for which you want to customize the new/edit/display form.

CustomizeIP

If you use “Customize form” via the ribbon, than you’ll only customize (or create) the default content type.

CustomizeInfoPathViaList

Step 3: create a couple of InfoPath forms per content type

Ok, now the setup is complete and we have all the components that we need, all we need to do now is to be able to reproduce all this stuff via code to another farm…