How To: Create a SharePoint Solution for an InfoPath Form

ūüí°
Update: This article was featured in the May 2008 edition of Microsoft's MSDN Magazine.

Summary

This post discusses how you can create a SharePoint solution package to deploy an InfoPath form to your SharePoint 2007 farm.  No coding required.

Downloads

SharePoint Solution Exporter EXE (zip)
SharePoint Solution Exporter source code (zip)

Overview

InfoPath forms are normally deployed manually using the Manage Form Templates administration tool in Central Administration.  These forms can also be deployed using the STSADM command.  Although both of these methods work perfectly well, they are not always the best option.

Since the release of SharePoint 2007/3.0 there have been a few new utilities that provide an improved and simplified deployment experience.  I have personally created installer classes for use with a packaged .msi file to simplify this process.  The problem is, I have been unable to deploy an InfoPath form to SharePoint via the object model.  Fortunately, I have discovered a very simple remedy.  The result is a quick and simple solution to create your InfoPath form solution packages…  Let SharePoint create the package for you.

Concept

If you have ever deployed an InfoPath form to SharePoint 2007, you may have also noticed that a new solution package appears in the Solution Management screen.  The name of this mysterious new solution begins with “form-“, followed by something that probably resembles the name of the InfoPath form you installed using the Manage Form Templates administration tool.  Chances are you probably assumed it had something to do with your form but just weren’t sure.

The new solution named ‚Äúform-SOMETHING-NNN‚ÄĚ is actually a solution package created by your SharePoint server, and it contains your new InfoPath form. ¬†This allows your InfoPath form to be deployed and retracted to the web applications of your choice just like any other solution. ¬†So, wouldn‚Äôt it be nice to see what that package looks like? ¬†Heck, it would be even better if you could use that package to redeploy your form (as a solution package, not as an InfoPath .xsn file) to other SharePoint environments such as your Integration Testing, User Acceptance Testing, and eventually on to your production environment. ¬†The only question remaining is how do you export that solution package out of your SharePoint farm? ¬†This is why I created the SharePoint Solution Exporter utility.

SharePoint Solution Exporter

The SharePoint Solution Exporter is a very simple, yet powerful little tool that allows you to export and save any solution installed on your SharePoint farm to your local disk.  Once you have exported your solution (.wsp) file you can rename it to a more appropriate solution name for easy and clear identification.  Then, you can take that solution and deploy it to another farm.  Here is what the SharePoint Solution Exporter tool looks like:

SharePointSolutionExporter

You must run this tool locally on your SharePoint web server.  To export a solution package:

  1. Enter the URL to your web server and click the Go button.
  2. A list of installed solutions will appear in the list body.
  3. Select the solution of your choice.
  4. Click the Download Solution File and specify name of your solution file in the Save As dialog.

I hope you find this tool as helpful as I have.

Note: For those of you interested in how to create a SharePoint solution package from scratch using Visual Studio, I hope to post an article soon on how to accomplish that as well.