Deploy custom InfoPath form with SharePoint list in VS2010

Olaf Keijsers picture Olaf Keijsers · Nov 8, 2010 · Viewed 7.4k times · Source

when I make a list in SharePoint 2010, I have the option to edit the forms for this list using InfoPath (by enabling a feature on the site collection and one on the site). When I save this form, it is saved as the default edit form for the list.

Now I am deploying my list from Visual Studio, as a WSP file. I would like to supply an InfoPath form with this list so that when the feature is activated, the list is created with the custom form attached. I can't seem to be able to find a way to add an InfoPath form to a list in this way though? I have tried creating a module and adding the form in there, but the only thing I can get it to do is to add the form into the list, not associate it with the list as an edit form.

I've found this blog post, which explains something similar but I'm not sure how it applies to my situation.

Any pointers would be greatly appreciated!

Answer

Dennis G picture Dennis G · Dec 14, 2010

The following tutorial will help you:
http://www.stuartroberts.net/index.php/2010/11/30/deploying-infopath-form-sharepoint/

Important steps along the way:

  • Deploy as module
  • Use RegisterForms in the feature manifest

And here is a link on how to attach your template to your list: http://spforsquirrels.blogspot.com/2008/03/assigning-infopath-form-template-to.html

Take note that you cannot have custom Infopath New/Edit forms for the list as described here, you can only create a forms library and attach your custom forms template to that library.