InfoPath 2007 Articles, Tutorials, and Solutions

Learn how to use InfoPath 2007 to create electronic forms by following step-by-step instructions from InfoPath articles and tutorials.

Integrate InfoPath with SharePoint

Auto-fill a repeating table with data from a SharePoint list when a row is inserted

Learn how to use rules and filters to automatically fill a repeating table row in InfoPath with data from a SharePoint list when the row is inserted.

Copy a SharePoint list to an InfoPath repeating table using XSLT

Use XSLT and the XslCompiledTransform class in C# to transform the data stored within a SharePoint list (secondary data source) and copy the transformed data to a repeating table in the Main data source of an InfoPath form.

Counting the amount of documents submitted today to a SharePoint library

Use an XPath expression to count the amount of documents that were submitted today to a SharePoint library.

Downloading InfoPath 2007 Forms in a Specific File Format from a SharePoint Form Library External content

Learn how to use a technique that enables users to convert and download Microsoft Office InfoPath 2007 forms directly from Microsoft Office SharePoint Server 2007 form libraries as files in a format that is not XML.

Filter and sort a SharePoint list in InfoPath using a DataView

Learn how you can use C# code and the DataView class that comes with ADO.NET to sort and filter items from a secondary data source to a SharePoint list in InfoPath.

How to add a data connection to a SharePoint list or library in InfoPath

This step-by-step InfoPath tutorial explains how to add a data connection to a SharePoint list or library and then view the structure of the secondary data source in the Data Source task pane.

How to create an InfoPath initiation or association form for a SharePoint workflow created in Visual Studio

Learn which steps are required to create an InfoPath form that can be used as an initiation or association form in a SharePoint workflow that is created using Visual Studio.

How to set the value of an InfoPath form field through a SharePoint workflow

Learn how you can write code in a custom Visual Studio workflow for SharePoint to set the value of a field that is stored within an InfoPath form.

How to simulate Excel's VLOOKUP function in InfoPath to look up data in a secondary data source using rules and filters

Learn how to use rules and filters to look up data in a secondary data source (here: a SharePoint list) when an item is selected from a drop-down list box and create functionality similar to Excel's VLOOKUP function, but then in InfoPath.

How to submit the rows of a repeating table in InfoPath to a SharePoint list

Programmatically add items from a repeating table in InfoPath to a SharePoint list by submitting a CAML update batch to the UpdateListItems method of the Lists web service that comes with Windows SharePoint Services (WSS).

How to use a SharePoint ItemAdded event handler and the object model to submit data from an InfoPath form to a SharePoint list

This article explains how you can use an ItemAdded event handler on a Form Library to extract data from an InfoPath form that was submitted to the form library and use this data to add a new item to a custom SharePoint list.

How to use a Visual Studio workflow to submit data from an InfoPath form to a SharePoint list

This article explains how you can use a custom Visual Studio sequential workflow on a Form Library to extract data from an InfoPath form that was submitted to the form library and use this data to add a new item to a custom SharePoint list.

How to publish an InfoPath form template as a new SharePoint site content type

This article provides the steps required to publish an InfoPath form template as a new content type on a SharePoint site.

Determine whether Forms Server is installed on a server

Check whether the Microsoft.Office.InfoPath.Server.dll and FormServer.aspx files are installed on the server.

Programmatically add an item/event to a SharePoint 2007 calendar using InfoPath 2007 and .NET code

Use the UpdateListItems method of the Lists web service that comes with Windows SharePoint Services (WSS) to add an item to a SharePoint calendar from within an InfoPath 2007 form.

Programmatically add an item with a Rich Text field to a SharePoint list using InfoPath 2007

Programmatically add an item to a SharePoint list by submitting a CAML update batch to the UpdateListItems method of the Lists web service that comes with Windows SharePoint Services (WSS).

Programmatically check whether a value exists in a drop-down list box bound to a SharePoint list using an XPath filter

Learn how to use an XPath filter expression on a SharePoint list to look up a value in a secondary data source to which a drop-down list box in InfoPath is bound.

Programmatically copy rows from a SharePoint list to a repeating node in the Main data source in InfoPath

Learn how to use C# or Visual Basic code to copy the rows from a SharePoint list to a repeating node in the Main data source of an InfoPath form.

Programmatically retrieve an InfoPath form from a SharePoint library

Use the System.Net.WebClient class or Copy web service to retrieve an InfoPath form from a SharePoint library.

Secure InfoPath forms in SharePoint using encryption

Learn how you can use encryption and decryption to secure and protect data stored in InfoPath forms that are displayed through a browser via SharePoint.

Use a custom SharePoint workflow to extract a file attachment from an InfoPath form and upload it to a SharePoint document library

This article explains how you can use a custom Visual Studio sequential workflow on a Form Library to extract data from a File Attachment control on an InfoPath form that was submitted to the Form Library and use this data to add a file to a SharePoint Document Library.

Use Rules and Formulas in InfoPath

Auto-populate a repeating table in InfoPath with sequential dates

Learn how you can use a function and formulas in InfoPath 2007 to populate rows in a repeating table with sequential dates by entering one date and having the rest of dates automatically calculated and displayed.

Calculate the difference between two date picker controls in InfoPath using rules and formulas - no code!

Use rules, conditions, and the number(), floor(), and substring() functions in formulas to calculate the difference between two date picker controls in InfoPath.

Calculating date differences in InfoPath using SharePoint Excel Services

Use an Excel workbook published to Excel Services on a Microsoft Office SharePoint Server 2007 to calculate the difference between two dates in InfoPath without writing a single line of code.

Create a day of the week InfoPath form using rules and formulas

Use a formula to calculate the number for the day of the week (Monday through Sunday) based on a date specified in a Date Picker control, and conditional formatting on sections to show/hide the weekday sections on an InfoPath form.

Display a message box if an item does not exist in the list of entries for a combo box

Use a rule to display a message box when an item entered into a combo box cannot be found in a list of valid entries.

Filter a SharePoint list in a repeating table in InfoPath on a date range

Use conditional formatting on a repeating table in InfoPath to filter a SharePoint list on a date range using two date picker controls.

Forcing users to select a particular day of the week from a date picker in InfoPath using rules and formulas

Use data validation, rules, and the number(), floor(), and substring() functions to derive and check the day of the week when a date is selected from a date picker control in InfoPath.

How to check whether a start date falls before an end date in InfoPath

This article shows you how to use data validation rules in InfoPath to compare two dates and check whether one date falls before another.

How to check whether the values of all fields in a Repeating Table in InfoPath have been set

This article shows you how to use Data Validation rules or Conditions on Rules in InfoPath to check whether all of the fields in a repeating table on an InfoPath form contain a value.

How to create a toggle button in InfoPath using rules and conditions

This article shows how you can create a toggle button in InfoPath using only rules and conditions; no code.

How to extract the month name from a date picker in InfoPath

earn how to use a secondary data source, rules, filters, and InfoPath functions to extract the month name from the secondary data source based on the date that is displayed in a date picker control.

InfoPath Basics: List control basics in InfoPath

This article explains how to use list controls such as drop-down list boxes, combo boxes, list boxes, and multi-select list boxes in InfoPath.

InfoPath Basics: Understanding Rules in InfoPath

This article explains what Rules are in InfoPath and how you can use them.

Selecting the minimum date in an InfoPath repeating table using formulas (no code)

Learn how you can use a formula (no code) in InfoPath to find and highlight the rows in a repeating table that contain the date that falls before all other dates in one of the repeating table's columns.

Integrate InfoPath with Microsoft Access

Use an Access table as a secondary data source in a browser-compatible InfoPath form

Use Microsoft Access' feature to link a table to a SharePoint list and then use this list as a secondary data source in a browser-compatible InfoPath form.

Integrate InfoPath with SQL Server

InfoPath does not support the specified database. The database must be a Microsoft SQL Server

Learn how to solve the InfoPath error: InfoPath does not support the specified database. The database must be a Microsoft SQL Server.

Retrieve an InfoPath form from SQL Server and display it in a new instance of InfoPath

Retrieve the XML value of the database field containing the InfoPath form, save it locally as a temporary file, and open it using this.Application.XmlForms.Open().

Retrieve an InfoPath form from SQL Server and display it in an InfoPath FormControl

Use code to retrieve the XML of an InfoPath form from SQL Server 2005, convert the InfoPath form into a MemoryStream object, and load this object into an InfoPath FormControl on a Windows Forms application.

Using a Receive data connection in InfoPath to execute an SQL Server stored procedure

Learn how to temporarily change the Command property of a Receive data connection in InfoPath to execute a SQL Server stored procedure and insert data into a database table.

Write Code for InfoPath

2 Ways to store InfoPath VSTA projects in a source control repository

Learn which 2 methods you can use when you create an InfoPath form template that is bound to a VSTA project and want to store the files in and then later fetch the files from a source control repository such as e.g. Visual SourceSafe.

4 Ways to programmatically add a row to a repeating table in InfoPath

Learn how to take advantage of the 4 overloads of the AppendChild method to programmatically add rows to repeating tables in InfoPath.

Automatically type in and add a new item to a drop-down list box on an InfoPath form

Use a combo box control and a web service to automatically type in and add new items to a list, thereby updating the underlying data store of the secondary data source that the combo box is bound to.

Autonumbering fields in a repeating table in InfoPath 2007 using VB.NET code

This article shows an example of using the Changed event of the row of a repeating table to programmatically autonumber a field in the repeating table using VB.NET code.

Trick: Clear or reset fields in InfoPath using only 3 lines of code

Learn how you can use just 3 lines of code and a 'special setup' in an InfoPath form to be able to clear or reset all of the fields or a subset of fields on an InfoPath form, whether it is browser-enabled or not.

Convert an InfoPath 2007 form into a Word 2007 document using XSLT and C#

Extract and use the document.xml part of a docx file to create an XSLT stylesheet to convert the XML of InfoPath forms into docx files.

Count the total amount of sections in a Repeating Section in InfoPath on insert or delete

Learn how to programmatically count the amount of sections in a repeating section control on an InfoPath form whenever a section is inserted or deleted.

How to create a class for an InfoPath form

Learn how to use the XML Schema Defintion Tool to generate a class for an InfoPath form.

How to deserialize an InfoPath form into a C# or Visual Basic object

Learn how to use the Deserialize method of the XmlSerializer class to convert the XML of an InfoPath form into a C# or Visual Basic object.

How to get HTML tags to appear as HTML and not as plain text in a Rich Text Box

Learn how to write code to render HTML in a Rich Text Box.

How to get the current row number of a repeating table in InfoPath using VB.NET code

This article shows how you can use Visual Basic .NET code in an event handler on the row of a repeating table to automatically number the rows of the repeating table and then retrieve the number of the row in a repeating table in which the value of a field has been changed.

How to loop through items in a repeating table in InfoPath 2007

Use the XPathNodeIterator class with C# or VB.NET code to loop through the rows and items in a repeating table.

How to programmatically get or set the XHTML code of a Rich Text field in InfoPath 2007

Learn how to use the InnerXml property of an XML node to get and set the XHTML code of a Rich Text field on an InfoPath form template.

How to submit rows of a repeating table in InfoPath to a web service

Learn how you can create a .NET web service that accepts data from the rows of a repeating table on an InfoPath form.

Programmatically add a row to a repeating table using an XmlWriter object

Use the XmlWriter object that is returned by the AppendChild method of the XPathNavigator object to add a row to a repeating table.

Programmatically add items to a drop-down list box in InfoPath 2007

Bind the drop-down list box to a repeating node in either the Main or a secondary data source, and then loop through rows of data in another data source to populate the data source that is bound to the drop-down list box.

Programmatically add lines of text to a Rich Text Box field on an InfoPath form using C# code

Use C# code to add DIV elements to apply line-breaks between lines of text in a rich text box field on an InfoPath form.

Programmatically convert Rich Text data from InfoPath to Word DOCX

Learn how to use the WindowsBase DLL and the System.IO.Packaging namespace to export the contents of a Rich Text Box field on an InfoPath form to a Word 2007 document.

Programmatically hide the first row of a repeating table in InfoPath

Learn how you can use a hidden field and conditional formatting to programmatically hide the first row of a repeating table in InfoPath.

Use Word 2007 to programmatically convert an InfoPath 2007 form to PDF

Use the Word 12 (= Word 2007) object model and the 2007 Microsoft Office Add-in: Microsoft Save as PDF to programmatically export an InfoPath 2007 form to PDF.

Programmatically create an InfoPath form from scratch using a Console application and C# code

Use a Console Application and classes in the System.Xml and System.IO namespaces to programmatically generate the XML for the InfoPath form.

Programmatically delete all of the rows of a repeating table in InfoPath

Learn how to use C# or Visual Basic code to programmatically delete all of the rows of a repeating table in InfoPath.

Programmatically delete the first row of a repeating table in InfoPath

Learn how to use C# or Visual Basic code to programmatically delete the first row of a repeating table in InfoPath.

Programmatically execute code when a repeating table row is inserted or deleted

Learn how to add events to rows of a repeating table instead of its fields.

Programmatically prevent users from adding more rows to a repeating table in InfoPath

Learn how you can use the Changed event of a repeating node and the DeleteSelf() method to programmatically prevent a user from adding more rows to a repeating table in InfoPath when the repeating table already contains a certain amount of rows.

Programmatically move items between two lists in InfoPath using C# code

Learn how to copy items from a secondary data source to a list in the Main data source of a form and then move items between two lists which are bound to two repeating groups in the Main data source of the form template.

Programmatically retrieve the value of an InfoPath form field using .NET code

Use the Copy XPath functionality to find out what the XPath expression of the field is and the Value property of the XPathNavigator object to retrieve the value of the field.

Programmatically retrieve the value of another field in the same row of a repeating table in InfoPath 2007

Use the Site property of the XmlEventArgs object in the Changed event of a field in a repeating table that is bound to a SharePoint list to retrieve the value of another field in the same row of the repeating table.

Programmatically select all items in a multiple-selection (multi-select) list box

Use C# or Visual Basic code to loop through all of the items in the secondary data source a multi-select list box is bound to, and add each item to the DOM node that represents the multi-select list box.

Using the Open XML Format SDK 2.0 to convert an InfoPath form into a DOCX file

This article shows a simple example of how to use the Open XML Format SDK 2.0 and C# code to convert and add the data from a rich text field and a repeating table to a Word 2007 document (DOCX file).

Miscellaneous Articles

How to create a hidden column in an InfoPath repeating table

Step-by-step instructions describing two ways to hide a column in a repeating table in InfoPath.

How to get data from a MySQL database into InfoPath using a Web Service

This article shows you how to use a Microsoft .NET Web Service to retrieve data from a MySQL database and display the data in an InfoPath form.

How to pre-fill a repeating table in InfoPath with rows of data

Learn how you can add default rows to a repeating table in InfoPath, so that when you open the form, the repeating table already contains a certain amount of rows with data.

How to submit data from an InfoPath form to a MySQL database using a Web Service

This article shows you how to use a Microsoft .NET Web Service to submit data from an InfoPath form to a MySQL database.

InfoPath 2007 Frequently Asked Questions (FAQ)

Frequently Asked Questions (FAQ) about InfoPath 2007 and Forms Server 2007.

InfoPath Basics: 3 Ways to validate data in InfoPath

Learn how to use InfoPath data types, data validation rules, and rules to check the value of a field in InfoPath.

InfoPath Basics: How to populate an InfoPath form when it is opened/loaded

This article explains how to use rules or code to fill form fields when an InfoPath form is opened or loaded.

InfoPath Basics: Main vs. secondary data sources

This article explains the difference between the Main and secondary data sources and shows you how to programmatically retrieve a reference to the Main data source or to a secondary data source.

InfoPath Basics: Repeating control basics in InfoPath

This article explains the basics of repeating tables and repeating sections in InfoPath.

InfoPath Basics: InfoPath Resource Files - purpose and benefit

Learn what resource files in InfoPath are and when you should use them.

Save / Print / Convert / Export an InfoPath form to PDF

Add code to the form to programmatically export the current view of the form to PDF or use the Save As PDF or XPS add-in for Microsoft Office 2007 to export a view.

Understanding the Multiple-Selection List Box in InfoPath

Learn how multiple-selection list boxes differ from other list boxes in InfoPath, how they store data, and how you can use this information to apply rules and conditional formatting, or to write code in InfoPath.

Working with InfoPath