InfoPath SharePoint: Submit InfoPath form to SharePoint List or Library using Content Type - SharePoint Development & Administration + InfoPath

Sunday, June 28, 2009

InfoPath SharePoint: Submit InfoPath form to SharePoint List or Library using Content Type

The following article demonstrates how to integrate an InfoPath form with a SharePoint form library, using a centralised template stored in a SharePoint document library and linked to a site Content Type. The form is set up to submit to a SharePoint form library

Overview:


  1. Set up SharePoint libraries
  2. Design the form template
  3. Publish form template to SharePoint Content Type
  4. Configure the form's primary data connection to submit to the SharePoint library
  5. Secondary Data Connections to receive or submit data to a SharePoint list
Setting up SharePoint to store the Form template and receive Submitted forms:
If InfoPath Form services are available on your SharePoint server, you have the option to store the form template using Central Administration's managed templates list.










To make the form available using this method it must uploaded to the Managed Templates List, the activated for the required site collection.

In this example I publish the form template to a Content Type, saving the template to the "Form Templates" document library in SharePoint. The content type can then be added to a Forms library or Document Library in SharePoint. When the "New" button is clicked on the SharePoint Document Library, a blank InfoPath form will open (in InfoPath, or the browser depending on form, SharePoint and client settings).


  • Create a Document Library to store the form templates. This can be a standard document library. Users of the form template only require read access to the form template to be able to fill out and submit a form. Restricting users acccess to "Read-Only" on the document library containing the form template will prevent any unauthorised access or modifications to the form template.
  • Note: Standard Version control and approval workflows can be set up to help manage form templates in this library.
  • Create a Form Library to store submitted forms and meta data. Use the standard Forms Library.
Design the Form

  • Open InfoPath and Design a Blank Form Template













  • From the Controls toolbar, add 2 text boxes to the form.
  • Right click on the first text box after and select "Text box properties" -> set the field name to "Description_1".
  • Repeat for the second text box, set the field name to "Description_2"

Set up the Primary Data Connection to submit to SharePoint



  • From the Tools menu, select "Submit Options..."
  • Check "Allow users to submit this form"
  • Select "SharePoint Document Library" from the drop-down list
  • Press "Add..." to set up the Primary Data connection
  • Enter the url of the form library created in the second step.
  • Press "Next"
  • Press "Finish"
  • Press "Ok" to close the Submit Option dialog.

Publish the form template to a SharePoint Content Type



  • From the file menu, select "Publish...", you will be prompted to save the form template locally if you have not done so. You are required to do this to be able to publish the form template to SharePoint.
  • Select "To a SharePoint server With or Without InfoPath Form Services" when asked where to publish the form template.






  • Enter the URL of your SharePoint Server, Example "http://SharePointServer/"





  • Select the publish method: "Site Content Type"
Publish Methods for InfoPath form Templates:
-Document Library: The template will be stored and set as the new item template for the specified document library.

- Site Content Type: You will be prompted for the location to store the form template as well as details of the Content type the template is being published to. Publishing a to a content type allows the template to be used in multiple document libraries.

- Administrator Approved Form Template: Allow the template to be published and made available using the Central Administration Managed Templates List.

In this example I will be publishing the form template to a site content type.



  • Select "Create a new Content Type"







  • Enter a name for the content type






  • When asked to specify a location for the form template, enter the URL of the library created in the first step, press Next.


  • Press "Add..", and select the "Description_1" field from the list


  • Repeat for the second field


  • Press "Next"


  • Press "Ok" to close

Add and Set the Content Type as the Form Library's Default

  • Using the browser, navigate to the SharePoint Form library created in the second step.
  • From the "Settings" dropdown menu for the library, select "Forms Library Settings"


  • Under the General Setting heading, click "Advanced Settings"
  • Select "Yes" to Allow management of content types


  • Press OK
  • Under the Content Types section of the Library Settings page, select "Add from existing site content types"
  • Add the newly created content type from the form library, press OK


  • You can either remove the default "Document" content type from the library or set the new content type as the default to allow a blank form to be opened in a browser or InfoPath when the "New" button is pressed on the form library.

When a new form is submitted, it will be submitted to the specified SharePoint form library, with data from the fields in the InfoPath form being mapped to Columns in the library.


Related Articles (SharePoint InfoPath Forms):

InfoPath - Update Existing SharePoint List Item Programmatically Using CAML
How to programmatically update an existing SharePoint list item from an InfoPath form using a CAML query and the lists web service of the SharePoint Site.

Integrate InfoPath Form with SharePoint Workflow
How to integrate InfoPath forms with workflow in SharePoint to give greater control over the functionality and user interface.When an InfoPath form is set up to submit to a SharePoint library, fields in the form can be mapped to columns/fields in the SharePoint library, or a content type which is associated with a document library.


InfoPath Form Content Type & Template Version management
How to manage updated versions of InfoPath form templates when used as Site Content Type.The following article demonstrates how to ensure that an InfoPath form created from an older version of the form template continue to load from the template version which they were created from, while any new form submitted to the library will always use the latest version of the form template.
Share this article:
Stumble This Delicious
Delicious
submit to reddit
Facebook
MySpace
MySpace

9 comments:

elizas said...

Good one .Thanks
http://www.mindfiresolutions.com/How-to-add-a-menu-button-to-a-specific-sharepoint-list-toolbar-851.php

Darren said...

I have a question. In our SharePoint site, we have three form libraries. Each library has five content types. The content types are five versions of the same InfoPath form. Each form has five views.

It's a complicated scenario but the gist of it is this: when a user opens a form in library A, we want view A of the form to open. When a user opens the form in library B, view B needs to open. And so on.

Since we are using the same IP forms in each library, we can't specify a default form view because that view opens regardless of the library. I was thinking of a Form Open rule; unfortunately, the conditions for such a rule only address the fields in the InfoPath form. What's required of such a rule is to basically say, "If opening from such and such library, then open in this view".

Any suggestions?

Thanks,
Darren.

DanielS said...

Hi Darren,

One possibility may be to add a column/field to the form template to specify the view that should open by default. This value in the form template can then be used to determine which view to open by default.

When a form is being submitted to one of the three libraries, the same procedure used to determine which library to submit to could also be used to set the value in the form's data source that will be used to switch to the required view when the form is opened.

You would then use Rules in the Form's the Open Behavior (Form Options), to set the view from the value in the additional field.

Is an automated process used to determine which library to submit to, the form submitted to all three libraries, or does the user specify which library to submit to?

Thanks

Daniel

Dan said...

SharePoint InfoPath Forms

Integrate InfoPath Forms With SharePoint

RichThorn said...

When attempting to publish the form from InfoPath (Publishing Method Step), I get the message - "An administrator must approve this form template before it can be filled out by a browser." The option to publish to Site Content Type is unavailable.

Is this related to how the form was built? or has it got something to do with the back-end admin settings in Sharepoint?

Unknown said...

Now that you have the form connected to your SharePoint Library, how do get it to send the user sumbitting the form a generic email, stating their request has been sumbitted once they hit the submit button?

DanielS said...

Hi Jenny,

Once the form has been submitted to the SharePoint library, a simple workflow created using SharePoint Designer can be associated with the Library. The workflow would trigger when a new form is added to the library (or an existing form updated if appropriate), and send an email using data submitted with the form.

The fields in the form that you would like to include in the generic email will need to be "promoted" either when publishing the form to SharePoint, or via Form Options > Property Promotion. These fields will then be available when configuring the generic email using SharePoint Designer. When selecting recipients of the email, use the option to select the User who initiated/triggered the workflow, or the user in the "Created By" or "Modified By" fields to send an email to the user who submitted the form. HTML can also be included in the message section of the email action in a SharePoint Designer workflow to format the email.

DanielS said...

RichThorn,

If you are attempting to publish a browser enabled form, make sure that InfoPath Form Services are enabled in the Web Application (Central Admin), in the Site Collection, and on the site where the form is being published to.

Unknown said...

Great guide in creating the submit form, but you missed the last step which I would also like to do. Could you provide guidance on this "Secondary Data Connections to receive or submit data to a SharePoint list"

Post a Comment