Wednesday, January 30, 2008

Publish InfoPath Form to SharePoint Server 2007

This documentation will guide you how to publish an InfoPath form to SharePoint Server 2007. Published forms in SharePoint will be used as a template in a library, particularly in a form library.

Create a Form Library

You need a Form Library in SharePoint before you publish the InfoPath form as a template to the library. If you can publish directly from InfoPath to SharePoint, you have the option to create the library on-the-fly when you are publishing the form using the publishing wizard. However, if you need to publish it manually, the library must be created before the form is published.
To create a form library, go to any site collection and click on Site Actions – Create (you must have permission to do this)

infopath-sharepoint-1

Under Libraries, choose the Form Library. Enter the name of the library, description and click the Create button

Create the InfoPath Form

Start designing the InfoPath form template. Make sure when creating a new form template, the ‘enable browser-compatible features only’ is checked – if you want to be able to open the form from the web browser. This allows users to view/open the forms without having to have InfoPath application installed on their PC.

infopath-sharepoint-2

This document does not teach you how to design an InfoPath form. Please visit Microsoft website for more details how to design InfoPath form.

Setup the InfoPath Property Promotion

You can promote the properties of the InfoPath form so that they become available as the content type of the form library in SharePoint. This allows you to view the properties of the InfoPath form directly from the SharePoint columns of the library.

From the InfoPath click: Tools – Form Options …
Click on Property Promotion category
Click Add… button and choose the fields to be added and click OK

infopath-sharepoint-3

infopath-sharepoint-4


Setup the InfoPath Compatibility

After you have finished designing your template, set the compatibility to be web browser enabled.
From the InfoPath click: Tools – Form Options …
Click on Compatibility category
Tick the ‘Design a form template that can be opened in a browser or InfoPath’ checkbox

infopath-sharepoint-5

Optionally, you can enter the URL where the Forms Services is running to verify the form with the server

Setup the InfoPath Security Setting

Security setting must be set to: Domain
From the InfoPath click: Tools – Form Options …
Click on Security and Trust category
Select the Domain radio box

infopath-sharepoint-6


Verify the InfoPath Form

Click on the Design Checker from the Design Tasks panel once you are ready to publish the form

infopath-sharepoint-7

infopath-sharepoint-8

Make sure you are getting 0 errors:

infopath-sharepoint-9

Publish the Form Template to SharePoint

To publish the form to SharePoint, click on Publish Form Template… from the Design Tasks panel

infopath-sharepoint-10

From the publishing wizard, you will see four options. You can try to publish directly to a SharePoint server by choosing the first option

infopath-sharepoint-11

Enter the URL of your site collection in which you created the form library


infopath-sharepoint-12

However, you might get the following error message:

infopath-sharepoint-13

If you are getting this error message, it is most likely that you cannot publish the form directly to the SharePoint server. Microsoft does not have solution at the time of this writing – workaround will be discussed later (Publish to a network location). Note this error only happens to InfoPath 2007. If you are using InfoPath 2003, most of the time you can publish directly to SharePoint.

If you are not getting the error message, you will be prompted to choose which library do you want to publish the form template to. Just follow the wizard.

If you successfully published the form directly to the SharePoint, you should have a new form template replaced with your InfoPath form template in your form library when you are creating a new document from the library

infopath-sharepoint-14

Publish InfoPath to a Network Location

This publishing method is an alternative or work around to publish the InfoPath form to SharePoint if the form can not be published directly to the SharePoint.

To publish the form to a network location, click on Publish Form Template… from the Design Tasks panel

infopath-sharepoint-15

From the publishing wizard, choose the third option

infopath-sharepoint-16

Specify the form template path where to save the form template (local or shared folder) and give the name for the form template

infopath-sharepoint-17

For the access path, make sure you left this field empty (!!)


infopath-sharepoint-18

Warning dialog box come out, click OK

infopath-sharepoint-19

Click Publish to finish

infopath-sharepoint-20

Upload The Published InfoPath Form Template to the MOSS Form Templates

You must have permission to SharePoint central administration to upload the form to form templates.

Go to Central Administration – Application Management
Under InfoPath Forms Services, click on Upload form template
Browse to the form that published earlier and click Upload
If you see error message, fix the template and try to upload again

Activate the New Form Template

The new form template must be activated before it can be used throughout a site collection.
Go to Central Administration – Application Management
Under InfoPath Forms Services, click on Manage Form Templates
Find the new form click on the arrow button and choose Activate to a Site Collection

infopath-sharepoint-21

Choose the site collection and click OK


Add the content type to the Form Library

Once the form template has been activated, the template can be used as a new content type for a library.

To assign the form template as a content type for a form library:
Go to the form library
Click on Settings – Form Library Setting


infopath-sharepoint-22

Under General Settings, click on Advanced settings
Choose Yes for allow management of content types, and click OK
Under Content Types, click on Add from existing site content type
From available Site Content Types, choose the new content type, click Add > and OK

infopath-sharepoint-23

Note: Under columns, you should see new columns that are the template properties being promoted earlier

infopath-sharepoint-24


Assign the Columns to View

By default, the view does not show the new content types. View must be changed to be able to show the content types.

From the form library, click on View: All Documents – Modify this View

infopath-sharepoint-25

Under Columns, tick the checkboxes that needs to be displayed and change the position as needed

infopath-sharepoint-26

Test the Template

The template has now been assigned to the form library. If you click new, you should see the new template name

infopath-sharepoint-27

If you choose the new template, is should open the InfoPath application (if you have it installed on your PC) or render the form to HTML based form. Once you have finished filling out the form, it depends on how the form was designed, it should be saved to the form library

When the form is saved to the library, you will see the properties of the from are picked up by the columns content type

infopath-sharepoint-28