Here I will take an InfoPath 2007 form that I have created in Visual Studio 2008 and publish it to a SharePoint 2007. This is all happening on a virtual machine that I use for development. In this example, I am creating a form that is used to capture minutes and action items in a Board of Directors’ meeting. My InfoPath has code behind to facilitate pushing specific elements of information to other lists in my SharePoint. We also have fields that we want to “property promote” as metadata on the library that will house the populated InfoPath form. This entry is going to show the steps necessary to publish the form to the SharePoint the first time.
Our first step is to click on Build->Publish in Visual Studio:
This kicks off a wizard that walks you through the necessary steps to publish this form out. The first frame asks where we want to publish the form. For our purposes, we select the SharePoint server option:
The next frame simply requests the url to the SharePoint which we will be using:
Next, we tell the wizard that we want this form to be web-enabled. In our case, we want this form to be an administrator-approved form template. This means that your SharePoint administrator will be required to upload this form via Central Administration to make it available to the SharePoint (which we will cover as well).
Now, for me, this next step is the not so intuitive part. Because we said we want this to be an Administrator-approved form, we need to save form off to a network location so the Administrator can get to the form when uploading in via Central Administration. So, we must tell it a location to save the form off to:
Property promotion. This is where we are telling InfoPath what pieces of data that it holds do we want pushed out to columns in our SharePoint library. It is important to understand this. Any data that you want a workflow to take action on, on any visualization of data that your users will require will need to be pushed out. You can always create a custom web part that actively pulls the data from the submitted InfoPath form, but in most scenarios that is a lot more effort than is really justified. For our example, we want to push out a few fields:
Click on Add gives us this dialog:
This dialog shows us our data source from our InfoPath form. We will use this interface to at the DateTime and Location data. Selecting these is telling the InfoPath form to take the data in these elements and push it to respective columns in the SharePoint list:
Click on Publish and you should see a dialog saying that you have successfully published this form:
Now, we need to upload this form via Central Administration. Open Central Administration, select Application Management. Then, under the “InfoPath Forms Services” heading, click on Upload form template:
Using the interface, browse to the form that we just saved and click “Upload”. If all goes well, you will see a message telling you that the upload was successful, like this:
Sometimes, in the message, there will be an instruction to run an stsadmin command to complete the action. When you see that, copy the command. Open an command prompt to run as administrator, navigate to the 12 hive bin and then execute the command. We are almost done. We now need to go into SharePoint and activate the form. We do this by going to the Site Collection Features, find our form (feature) and click on Activate:
All that is left now is to associate this content type with a library that you want. If you make changes, follow the same steps to re-publish the form, except you will not have to activate, unless you change the properties promoted. If you do that, you will need to deactivate and re-activate the form.