Deploying InfoPath Form to SharePoint 2010 Site

Deploying an InfoPath form to SharePoint 2010 is relatively straight forward, as long as you remember a few simple steps.

For an easier deployment experience, avoid code behind (managed forms) in your InfoPath form unless you really have to. That’s for another day, so this post will concentrate on how to deploying an InfoPath form with no associated code behind files.

Open InfoPath and either open or create a form. I’m not going to go into how to hook up the form with a data connection, just how to configure and publish it.

Once you’re happy with your form, have added any relevant data connections and wired up a submit button, you’ll need to set the trust level to Domain. By default this will be set to Restricted, which is too low for use in SharePoint. If you try to deploy a form with a restricted trust level the form will not be able to:

  • use data connections (with the exception of submitting via email)
  • run managed code or script
  • use custom or ActiveX controls
  • Process rules associated with opening the form

To change the security level, click on the File tab in the ribbon and then select Info from the left hand menu (should be auto selected). Click Advanced form options from the list provided. This will load the Form Options dialog. Select the Security and Trust category and change your settings to the Domain security level, as shown in the following screenshot:

To deploy the form from SharePoint you’ll need to publish the form and use the published version within your SharePoint project. Stay on the File tab and select Publish from the left hand menu. From the list of options presented, click Publish form to a network location or file share.

Select a location to publish the form to (you’ll need to make sure that this is the file you include in your SharePoint deployment project) and give it a name. As we’ll be publishing this form to SharePoint and all users will access it from the form templates gallery, make sure the second screen of the Publishing Wizard does not contain a path. SharePoint will then ensure users can access the form, so no need to provide an alternate access URL.

Click next and OK the popup ignoring the warning about users not being able to access the form. Finally, click Publish to create a published version of your form.

From within your SharePoint project, you’ll need to add the published InfoPath form and configure a feature to correctly deploy it. To add the form, create a new module, deleting the Sample.txt file that it automatically creates. Add the published form to this module. Your module’s elements XML file should now look something like the following:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
  <Module Name="FormsModule">
    <File Path="FormsModule\aform.xsn" Url="PublishedForms/aform.xsn" />

Next, you need to edit the manifest for the feature that deploys the form module. Open the feature in Visual Studio and click the Manifest link at the bottom of the screen.

From the manifest page, click the Edit Options link, which will bring up an editor window similar to the following:

Change it to contain the following text:

You’ll need to change the value for the key RegisterForms so it points to the name of the module you created earlier. This will register your form(s) when the feature is activated, providing you follow the next set of steps.

From the feature’s main page, bring up the properties window for it and set the following property values:

Receiver Assembly = Microsoft.Office.Workflow.Feature, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c
Receiver Class = Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver

By hooking up the feature to use the WorkflowFeatureRecevier class from the Microsoft.Office.Workflow.Feature assembly, the property values added to the feature manifest will be loaded and processed as it is activated. This ensures that your form is uploaded to the form templates gallery (in SharePoint) and registered correctly.

You should now be able to use the form within your SharePoint instance, for example by using it as an instantiation form for a custom workflow:

<Elements xmlns="">
     Name="Workflow name"
     Description="Workflow description"
      <Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:aform:-myXSD- 2010-11-30T17-05-30</Instantiation_FormURN>

You can get the URN for your InfoPath form by opening the form in InfoPath in design mode, changing to the File tab and clicking the Form Template Properties button, located to the right of the screen. This will display a dialog which contains a field called ID, the content of which is the value required for the URN in the above XML.

This entry was posted in InfoPath, SharePoint and tagged , . Bookmark the permalink.

6 Responses to Deploying InfoPath Form to SharePoint 2010 Site

  1. Patrick says:

    Excellent article! There are very few on this subject that I could find. I have followed your steps above, but unfortunately the form still opens in InfoPath. Using this technique are the forms published at the farm level or site collection? If I do have some VSTA code behind and data connections to files in a Data connection library is there anything special I need to do to get it to work? Publishing to a network seems to me like the wrong thing to do.

    • Stuart says:

      Hi Patrick,

      You need to publish to a network location if you want to deploy the xsn as part of your solution. Choosing another publish option such as SharePoint Server would not give you the ability to package the form in your solution, but would immediately publish it to the location you specified.

      Following the steps from this article will deploy the form to the root of the site collection where you activate the feature.

      As for not having the form display in the browser, there could be many reasons why this is failing. Is your form being used as a workflow association\initiation form for instance? Or are you attaching the form to a content type? Take a look at the following post for more info: Programatically register InfoPath form for Web Browsing in SharePoint.

  2. Patrick says:

    Hi Stuart

    I published my .xsn file to a network location and included it in my SharePoint solution. It’s a very simple form no code and no data connections. It just has a few fields for testing.
    I was hoping to publish the form to a publishing site inside the FormServerTemplates form library.

    My feature below actually deploys the InfoPath file to the FormServerTemplates form library but when I click on the file using my browser the file always opens in Infopath and not the browser.

    I have also looked at your other article but



  3. Patrick says:

    Sorry looks like WordPress stripped out all my code

  4. sandesh says:

    Good Article..Thanks for sharing.

  5. Philip says:

    Does this work for a sandbox solution?

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve the maths problem shown below before posting: *