InfoPath 2007 Tutorials and Articles
Learn how to use InfoPath 2007 to create electronic forms by following step-by-step instructions from InfoPath tutorials and articles.
InfoPath 2007 Basics
Work with InfoPath in general
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.
Learn how to use InfoPath data types, data validation rules, and rules to check the value of a field in InfoPath.
This article explains how to use rules or code to fill form fields when an InfoPath form is opened or loaded.
Frequently Asked Questions (FAQ) about InfoPath 2007 and Forms Server 2007.
Learn what resource files in InfoPath are and when you should use them.
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.
This article explains what Rules are in InfoPath and how you can use them.
Write code in general for InfoPath
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.
Learn how to use the XML Schema Defintion Tool to generate a class for an InfoPath form.
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.
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.
Use a Console Application and classes in the System.Xml and System.IO namespaces to programmatically generate the XML for the InfoPath form.
Work with Controls in InfoPath 2007
This article shows how you can create a toggle button in InfoPath using only rules and conditions; no code.
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.
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.
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.
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.
This article shows you how to use data validation rules in InfoPath to compare two dates and check whether one date falls before another.
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.
Drop-Down List Boxes, Combo Boxes, and List Boxes
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.
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.
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.
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.
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.
Multiple-Selection List Boxes
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.
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.
Rich Text Boxes
Learn how to write code to render HTML in a Rich Text Box.
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.
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.
Repeating Tables and Repeating Sections
Learn how to take advantage of the 4 overloads of the AppendChild method to programmatically add rows to repeating tables in InfoPath.
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.
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.
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.
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.
Step-by-step instructions describing two ways to hide a column in a repeating table in InfoPath.
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.
Use the XPathNodeIterator class with C# or VB.NET code to loop through the rows and items in a repeating table.
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.
Learn how you can create a .NET web service that accepts data from the rows of a repeating table on an InfoPath form.
Use the XmlWriter object that is returned by the AppendChild method of the XPathNavigator object to add a row to a repeating table.
Learn how to use C# or Visual Basic code to programmatically delete all of the rows 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.
Learn how to add events to rows of a repeating table instead of its fields.
Learn how you can use a hidden field and conditional formatting to programmatically hide the first row of 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 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.
This article explains the basics of repeating tables and repeating sections in InfoPath.
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.
Access Databases from InfoPath 2007
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.
This article shows you how to use a Microsoft .NET Web Service to submit data from an InfoPath form to a MySQL database.
SQL Server databases
Learn how to solve the InfoPath error: InfoPath does not support the specified database. The database must be a Microsoft SQL Server.
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().
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.
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.
Convert InfoPath Forms
Convert InfoPath to Word
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.
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.
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).
Convert InfoPath 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.
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.
Integrate InfoPath 2007 with SharePoint 2007
Also see InfoPath 2007 browser forms for more InfoPath with SharePoint integration tutorials and articles not listed here.
Retrieve and use data from SharePoint
Learn how to auto populate a repeating table in InfoPath by using rules and filters on data from a SharePoint list when the row is inserted.
Learn how to copy data from a SharePoint list to a repeating table in InfoPath by using XSLT and C# code to transform the data from a secondary data source and store it in the Main data source.
Use an XPath expression to count the amount of documents that were submitted today to a SharePoint library.
Use conditional formatting on a repeating table in InfoPath to filter a SharePoint list on a date range using two date picker controls.
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.
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 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.
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.
Use the System.Net.WebClient class or Copy web service to retrieve an InfoPath form from a SharePoint library.
Learn how you can encrypt InfoPath forms and decrypt them again to protect and secure InfoPath forms in SharePoint.
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.
Submit data to SharePoint
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.
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 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).
Publish InfoPath to SharePoint
This article provides the steps required to publish an InfoPath form template as a new content type on a SharePoint site.
Workflow in SharePoint
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.
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.
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.
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.