Deploy InfoPath form as SharePoint feature in SharePoint2010
You can publish your InfoPath form directly to SharePoint2010 using InfoPath2010 publishing feature. However, some of the clients require that all SharePoint deployment has to be done using SharePoint features and solutions. Next, I will show you how to do this:
Change the form Security Level to Domain
Publish the InfoPath form to a network location
Create an Empty SharePoint project as follows(one element and one feature)
Change the Deployment Location Path of Elements.xml file to root (i.e. empty location) as highlighted below
Change the Deployment Location Path of ContactUS.xsn file to root (i.e. empty location) and change Deployment Type from NoDeployment to ElementFile as highlighted below
Add the feature receiver Assembly Microsoft.Office.InfoPath.Server, Version=188.8.131.52, Culture=neutral, PublicKeyToken=71e9bce111e9429c
and add the feature receiver Class Microsoft.Office.InfoPath.Server.Administration.XsnFeatureReceiver to the feature properties as highlighted below.
Navigate to the current feature >> Manifest then add the following properties as below(this is not used in this project , but used in deploying Workflow initiation form or association form
- Deploy the solution to a SharePoint site , you will find the InfoPath form under the InfoPath contentType. You can download the sample code here, however you need to open the ContactUsFormUnpublished.xsn using InfoPath Designer and republish the form(Make sure you publish your form to a network location otherwise you might get the The XSN cannot be used on the server.) and replace the current published form in the project with the new one.