InfoPath Forms Services - Share Point 2010

Introduced in MOSS 2007, InfoPath Forms Services allows forms created using the InfoPath client application to be rendered as HTML, allowing users to complete forms without having the client application installed.
Most services in SharePoint 2010 are implemented as service applications and are configured via the Manage Service Applications option in Central Administration. InfoPath Forms Services works a bit differently and can be configured as follows:

  1. Open SharePoint Central Administration.
  2. Select General Application Settings from the Central Administration pane on the left:InfoPath Forms Services
    In the InfoPath Forms Services section, you’ll see various configuration links.(In-depth coverage of each of these options is outside the scope of this;Generally speaking, the default configuration is appropriate for most situations. The Manage Form Templates and the Manage Data Connection Files options are useful for allowing you to manage form templates and connections.
    To enable InfoPath Forms Services within a web site, you must enable the SharePoint Server Enterprise Site Collection features at the site-collection level. To add these features, take the following steps:
  3. From the Site Actions menu, select Site Settings.
  4. In the Site Collection Administration section, click Go To Top Level Site Settings.
  5. InfoPath Forms Services

  6. In Site Collection Administration, choose Site Collection Features. If it’s not already activated, click the Activate button next to SharePoint Server Enterprise Site Collection Features.

BrowserForm Web Part
Rendering of InfoPath forms in the web browser is carried out by the new BrowserForm web part. So that we can see this in action, we’ll create a basic Hello World InfoPath form.

  1. Using SharePoint Designer, create a new blank web site.
  2. Follow the preceding steps to ensure that InfoPath Forms Services is enabled at the Site Collection level.
  3. From the Site Objects pane, select Lists and Libraries, and then select Document Library from the New section of the Lists and Libraries tab on the ribbon. Create a new Form Library named MyForms, as shown:
  4. BrowserForm Web Part
  5. Open InfoPath Designer 2010, click on the File menu to see the backstage area, choose New, and then click the Blank form icon, as shown:
  6. Browser Form Web Part
  7. Click Design This Form to create a new form template.
  8. Change the title to Hello World:
  9. Browser Form Web Part

  10. To publish the form to SharePoint, open the File menu to return to the backstage area. Click Publish Your Form to view the publishing options.
  11. Select Publish Form to a SharePoint Library.
  12. When prompted to save the form, save a copy to a location on the local file system.
  13. In the Publishing Wizard dialog, enter the URL of the blank SharePoint site that we created earlier, as shown. Click Next to move to the next step.
  14. Publishing wizard

  15. For the purposes of this simple demonstration, we’ll publish the form as a template for the form library that we created earlier. Select Form Library from the list of options and ensure that the Enable This Form To Be Filled Out By Using A Browser Checkbox is checked. Click Next to move to the next step.
  16. Publishing wizard

  17. Select Update The Form Template In An Existing Form Library and then select the MyForms library from the list. Click Next to move to the next step.
  18. Publishing wizard

  19. In this simple demo, we’re not collecting any data or using any parameters. Click Next to move to the final step of the wizard, and then click Publish to publish the form to SharePoint. To illustrate the use of the BrowserForm web part, we’ll add the web part to the home page of our blank site and then configure it to pick up the Hello Word form that we’ve published.
  1. Using the web browser, navigate to the home page of the blank site that From the Site Actions menu on the ribbon, choose Edit Page.
  2. In the Left section, click the Add a Web Part link and then, in the web part selector that appears at the top of the page, select the Office Client Applications category, as shown:
  3. Office Client Applications category

  4. Select the InfoPath Form Web Part, and then click Add at the far right of the window to add it into the left zone of the page.
  5. Click the Click Here To Open The Tool Pane link in the InfoPath Form Web Part section of the page.
  6. From the List or Library drop-down, select MyForms. The Content Type and Views drop-downs will be populated automatically. Click OK to commit the changes.
  7. Office Client Applications category

  8. The demonstration InfoPath form will now be displayed on the page, as shown next. Click Stop Editing from the ribbon to exit design mode.

Office Client Applications category

In this simple example, you’ve seen how to create an InfoPath form and use it within a web part page. In the examples that follow, we’ll delve further into the functionality of InfoPath. However, as you’ll see, the publishing mechanism remains pretty much the same regardless of the type of form you’re creating.

Using InfoPath Forms in SharePoint
In SharePoint applications, InfoPath forms are used in four main ways: to create form templates, custom forms for SharePoint lists, document information panels, and workflow forms.

Creating Form Templates
SharePoint form templates are similar to forms used by other Office applications such as Word and Excel. Using the InfoPath client, you create form templates that are used for a SharePoint document library. As users complete the form and submit the data to SharePoint, the form is stored in the document library in the same way a Word document or any othercontent would be stored. The main benefit in using InfoPath in this context as opposed to Word is that, although the InfoPath form can be completed using the InfoPath client application, for users who don’t have the client application installed, the form will be automatically rendered for completion in the browser. Another key benefit is that the individual data items captured in an InfoPath form can be bound to columns in the document library. Although this is also possible using other Office applications, with InfoPath it’s a bit more transparent.

NOTE In SharePoint 2010, you can install Office web applications so that a web-based version of applications such as Word and Excel will be available for use via the web browser if a user doesn’t have the client application installed. In this case, using a Word template would also allow users to complete forms within the browser. In the preceding example, you learned how to create a basic form and publish it to a form library. In effect, we created a form template that SharePoint can use to create new documents for storage within the MyForms library. To see this working, navigate to the MyForms library, open the Documents tab in the ribbon, and select New Document. You can see that our InfoPath template is displayed in a new page. Click Save and then enter MyTestFile as the filename. Click Close to return to the MyForms document library. You can see that a new document named MyTestFile has been added to the library. Let’s take a look at a more in-depth example of this type of form to see how you can capture data in InfoPath and save it within specific columns in SharePoint. In this example, we’ll create a custom form that can be used by employees to request demonstration equipment. We’ll create a new form library for this example.

  1. click Documents from the menu on the left and then select Create. Add a new Form Library and name it Demonstration Equipment Requests.
  2. Equipment Requests.
  3. Open InfoPath Designer. In the New section of the backstage area, select SharePoint Form Library and then click Design This Form.
  4. Change the form title to Demonstration Equipment Request, the top section title to Customer Details, and the bottom section title to Equipment Details, as shown here:
  5. Demonstration Equipment Request

  6. Before we add data entry controls to the page, we’ll define the data structure for our form. Behind the scenes, the data structure is defined as an XML schema. In the Fields pane on the left side of the page, right-click the myFields node and then select Properties from the context menu. Change the Name to EquipmentRequest.
  7. In the Actions section, click Add Field. Create a new field of type Group and type the Name as Customer. Repeat this step to create another group named Equipment.
  8. Select the Equipment node and then click Add Field. Add a groupnode and type the Name Item; however, this time check the Repeating checkbox, as shown:
  9. Add Field or Group

  10. Now we can begin to add nodes for our individual fields. Within the Customer group, add the following fields:
  11. Add Field or Group

  12. Within the Item repeating group, add the following fields:
  13. repeating group, add the following fields

  14. In the Equipment group, add the following fields:
  15. Equipment group
  16. After all fields have been added, the data structure should look as shown next. If any fields are not in the correct location, right-click the wayward field and select Move from the context menu to relocate the field within the data structure.
  17. Equipment request
    We can now start adding controls to capture data for our fields. The design experience in InfoPath is very much data-led. When we define the data source first, creating a user interface is often a case of simply dragging the appropriate data elements onto the page. InfoPath Designer automatically inserts an appropriate input control that is bound to the correct field.

  18. In the Customer Details section, select the cells that are underneath the title, and then, from the Layout tab of the ribbon, select Merge Cells. Repeat this step for theEquipment Details section. The revised form should look as follows:
  19. Demonstration Equipment request

  20. Drag the Customer group element into the Customer Details section of the form. InfoPath Designer will automatically add text boxes for each field together with labels for the field name. Rather than having the controls laid out sequentially on the page, we can reformat them into a table by converting the section control into a Controls in Layout Table control. Select the Section control, and from the Properties menu in the ribbon, select Change Control | Controls in Layout Table.
  21. Although our layout table looks much tidier than the standard section control layout, we no longer have field labels. We can add these in by selecting a control within the layout table and then choosing Insert Left from the Layout tab in the ribbon. To get the name of the field, place the cursor over the adjacent text box control; this will show the field element to which the control is bound. Using this technique, add in appropriate labels for each field.
  22. Tables in InfoPath can be resized in much the same way as they are changed in Word and Excel: simply drag the edges of the columns to the appropriate size. Using this method, resize the table so that all data can be clearly seen as shown

Demonstration Equipment request

Now that we’ve added controls to capture details of the customer that’s requesting demonstration equipment, the next section of our form allows users to enter details of the equipment required. Since more than one piece of equipment may be required by a customer, we’ve added a repeating Item section to our data set. We can allow users to add as many items as they need by creating a repeating table on the form.

  1. Drag the Item repeating Group onto the Equipment Details section of the form.
  2. Select Repeating Table from the pop-up list of options.

Adding Formulae to FieldsOur Item data element contains two columns, LineTotalCost and LineTotalValue, that should be calculated based on the values entered in other columns in the row. To add formulae for these fields, take the following steps:

  1. Select the Line Total Cost text box in the repeating table control. From the Properties tab in the ribbon, select Default Value.
  2. In the Field Or Group Properties dialog, click the fx button next to the Default Value text box.
  3. Using the Insert Field or Group button to select the appropriate fields, add this formula, as shown next: Quantity * StandardCost.
  4. Quantity * StandardCost.

  5. Repeat the process for the Line Total Value text box. This time add this formula: Quantity * ListPrice.
  6. To prevent users from entering values in these calculated fields, we need to change them from text boxes to labels. Click the Change Control option from the Properties tab on the ribbon, and then select CalculatedValue.

Publishing a Form Template to SharePointOur basic Demonstration Equipment Request form is now complete.
To publish it to SharePoint and use it for capturing data for our Demonstration Equipment Request library, take the following steps:

  1. As we did earlier, from the backstage area, click Publish Form To A SharePoint Library.When prompted, save a copy of the form named EquipmentRequest.xsn to the local file system.
  2. Select Form Library from the list of options, and then select the Demonstration Equipment Requests library. Click Next to move to the next step of the wizard.
  3. When we published our simple form earlier, we skipped this section. Since we want to capture data from our equipment request form, we need to specify which fields we want to include as columns in our document library. By clicking the Add button in the upper section of the form, add all fields within the Customer group to the library, as shown:
  4. Publishing a Form Template to SharePoint

  5. Click Next and then click Publish to add the form to our library. Using the browser to navigate to the Demonstration Equipment Requests library, you can see that by clicking the New Document button on the Documents ribbon, our InfoPath form is displayed, allowing us to enter details as expected. To store the form in the document library, we must use the Save option and name the form. By performing this step, we’re saving a copy of the form in the document library and at the same time copying the field values that we specified earlier into columns.

Creating Custom Forms for SharePoint Lists
Another use of InfoPath forms, and one that’s become more prevalent with SharePoint 2010, is in the creation of custom new and edit forms for SharePoint lists. Custom forms differ from the form templates that we saw earlier: the form itself is not stored in the library. Since custom forms can be used only with lists, only the field data that we elect to include is copied to columns in the list as opposed to the entire completed form. Let’s create a custom form for a SharePoint list:

  1. Using SharePoint Designer, create a new custom list named MyCustomList. From the Lists and Libraries navigator, double-click the MyCustomList icon to manage the settings for the list.
  2. In the List Settings tab of the ribbon, select Design Forms in InfoPath | Item. InfoPath Designer will then open, displaying a basic template for capturing list item data.
  3. Additional fields can be added using the Add Field link in the Fields pane. When you add a field to the form, a column is also added to the underlying list to store the captured data. For example, we could add a field named Description. Once the form is published, a new column named Description will be added to our custom list.
  4. To publish the customized form, click Info in the left pane and then click the Quick Publish button in the backstage area:

Form Information
Creating Document Information Panels
When creating Office documents for use with SharePoint, certain metadata is required by default, such as a title for the document and any relevant tags. Along with the default metadata that’s required by the Document content type, you can add additional metadata that will be stored as specific columns in the document library. This data is captured using a Document Information Panel, and customization of such a panel is another important use of InfoPath.

  1. From the Site Objects pane in SharePoint Designer, select Lists And Libraries. Add a new Document Library and name it Purchase Orders.
  2. Double-click the Purchase Orders icon to manage the settings for the document library. In the Settings section, check the Allow Management Of Content Types checkbox, as shown. Click the Save icon in the upper-right corner of the Designer window to persist the changes.
  3. Creating Document Information Panels

  4. From the Site Objects pane, select Site Columns. Add a new column of type Currency. Type the Name of the column as Amount and add it to the Custom Columns group.
  5. Add another column of type Single Line of Text. This time type the name Customer Reference. Again, add it to the Custom Columns group.
  6. Click the Save icon in the upper-right corner of the Designer window to persist the changes.
  7. From the Site Objects pane, select Content Types, and then, from the New section of the Content Types ribbon, click Content Type. Type the Name as PurchaseOrder and the parent content type to Document, as shown next. Add the content type to the Document Content Types group.
  8. Create a content type

  9. Double-click the Purchase Order content type to manage its settings, and then click the Edit Columns button in the ribbon.
  10. Click the Add Existing Site Column button to add the Amount and Customer Reference columns that we created earlier. Click the Save icon to persist the changes.
  11. With the Purchase Order content type selected, from the Actions section of the Content Types ribbon, select Apply to List. Select the Purchase Orders document library from the Lists and Libraries picker.
  12. NOTEWe’ve touched on a few key concepts of the SharePoint data structure in the course of setting up this example.

  13. Configuring document information panels can be done only from a browser-based user interface. Using the browser, navigate to the Purchase Orders document library. From the Library tab of the ribbon, select Library Settings.
  14. In the Content Types section, click the Purchase Order content type and then select the Document Information Panel settings link. Document Information panels are configured at the content type level. In effect, a document information panel is responsible for providing a user interface to capture and display data that is stored in the columns that are referenced by the content type. In the case of our example, we added two additional columns: Amount and Customer Reference.
  15. Click the Create A New Custom Template link. This will open InfoPath Designer, where we can customize the system generated Document Information panel.
  16. Select the Customer Reference text box, and then from the Properties tab of the ribbon, select Change Control | Combo Box.
  17. Click the Edit Choices button, and using the Add button, enter a few sample customer reference values.
  18. To publish the Document Information panel to SharePoint, click File to enter the backstage area, and then select Publish Your Form. When prompted, enter a filename on the local file system to save the form before publishing. If you navigate to the Purchase Orders document library, you can now select New Document | Purchase Order from the Documents tab to see the fruits of our labor. A blank Word document is shown with our custom information panel at the top of the page.

Creating Workflow Forms

The final use, and one that I’ll cover in more detail, is the creation of workflow forms. Often, as part of a workflow process, you’ll need to capture additional user input. InfoPath, and particularly the ability of SharePoint Designer to create appropriate InfoPath forms automatically, makes it easy to capture this additional information.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Share Point 2010 Topics