Publishing InfoPath 2007 Form Templates to Servers Running InfoPath Forms Services
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Summary: Learn how to use Microsoft Visual Studio 2005 Tools for Applications to add managed code to a Microsoft Office InfoPath 2007 form template, publish it to a network share, and upload it to InfoPath Forms Services.
Applies to: Microsoft Office InfoPath 2007, Microsoft Office SharePoint Server 2007
David Gerhardt, 3Sharp
August 2007
![]() With the InfoPath Forms Services capabilities in Microsoft Office SharePoint Server 2007, you can develop Microsoft Office InfoPath 2007 solutions that extend beyond the corporate firewall, delivering forms for Web browsers or even mobile devices. In browser scenarios, your forms can contain most of the rich functionality that is available in InfoPath 2007, and the publishing process for these forms is very easy. ![]() Whether or not you use managed code in your form template, the publishing process starts with the InfoPath Publishing Wizard. For this scenario, you use the travel request sample that is included with Office InfoPath 2007, add a few lines of managed code to calculate a trip duration, and then publish the form template to InfoPath Forms Services. Adding a Duration Node Start the travel request sample template in the InfoPath designer, and follow these steps to add a Duration node. To add a Duration node to the form view
![]()
You must save the form template locally before you add any code.
Including a Calculation Private Function To add managed code to your form solutions, you can use Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office system (VSTO 2005 SE) or Microsoft Visual Studio 2005 Tools for Applications (VSTA). Office InfoPath 2007 includes Visual Studio 2005 Tools for Applications, which you use in this scenario to add a private function that calculates the total number of days in a given period. ![]()
You can set the programming language to Visual Basic or Visual C# before you add managed code to your form template. To do this, on the Tools menu, click Form Options, click the Programming category, and set the Form template code language list value accordingly.
To include a calculation function
In the GetDuration function, the longDayCount long type identifies the difference in ticks between two date values divided by 864000000000 (the constant number of ticks in a day) plus 1. The result is the duration in days for the two date values and becomes the return value for the function. Adding the Changed Events The Duration expression box is meant to be updated with a new calculated value each time the departure date or return date is changed. Therefore, you add a Changed event for the Departure Date and Return Date date picker controls. To add Changed events
Each Changed event makes a call to the GetDuration procedure and sets the Duration node accordingly. Updating Postback Options Before the form template is deployed, you must update the two date picker controls to ensure that data is sent to the server each time the departure date or return date is changed. To update the date picker controls
Deploying the Form Template Because the form template uses managed code for a browser scenario, it must be admin-deployed. In other words, you must first publish the form template to a network share. ![]()
If a form template does not contain managed code, you can publish it directly to a SharePoint site.
To publish a form template to a network share
After the form template is published to a network share, a server administrator can upload that form template to InfoPath Forms Services and activate it to a specific Windows SharePoint Services 3.0 site collection. To upload a form template to InfoPath Forms Services
Starting the Travel Request Form To test your changes, start the travel request form template in the browser and modify the Departure Date and Return Date fields. To modify the Departure Date and Return Date fields
![]() InfoPath 2007 enables you to develop form templates that can run in InfoPath Forms Services, thus allowing them to be accessed from a Web browser. With Visual Studio Tools for Applications, you can use the InfoPath event framework to easily add managed code to these form templates. To admin-deploy these form templates:
|
![]() ![]() Video Length: 00:09:33 File Size: 9.08 MB WMV ![]() |