inset
InfoPath to Support Managed Code
Mar. 15, 2004

A pair of planned updates—one for InfoPath and one for Visual Studio .NET (VS.NET) 2003—will allow developers to go beyond scripting and use languages such as C# and Visual Basic .NET when building InfoPath solutions. The release aligns InfoPath more closely with Microsoft's developer strategy and makes it more likely that InfoPath will benefit from further investments in .NET developer technology. However, the technology gap between VS.NET and InfoPath and Office (which are based upon older technologies such as COM and scripting) remains and is unlikely to be bridged until Office 12.

Bringing .NET to InfoPath

Introduced with Office 2003, InfoPath is an application for building forms that enable users to enter and display XML data. In addition to providing a user interface for XML data, InfoPath forms can contain custom code, written in scripting languages such as VBScript and JScript, that is executed when certain conditions occur. For example, an expense report form may contain code that adds up the total as new expenses are added.

However, its reliance on scripting languages has put InfoPath at odds with the rest of Microsoft’s developer strategy, which has been steadily moving toward the .NET Framework and managed code. (For background information on the .NET Framework and managed code, see the June 2003 Research Report, "The .NET Development Platform.")

The combination of InfoPath 2003 Service Pack 1 and InfoPath 2003 Toolkit for VS.NET will enable developers to use languages such as C# and VB.NET to extend InfoPath forms. Once installed, the developer toolkit adds new InfoPath items to the New Project dialog box of VS.NET and integrates with InfoPath so that VS.NET is automatically invoked to edit C# or VB.NET code.

However, the support for managed code has limitations that developers will need to consider.

More complex deployment. Unlike script code that is contained in the InfoPath form file, the C# or VB.NET code built by VS.NET is packaged as a DLL, which must be separately installed on client systems. Therefore, deploying an InfoPath solution that uses managed code is more complicated than deploying a similar solution based upon script code.

No mixed code. Use of managed code within InfoPath is an all-or-nothing proposition. Adding managed code to a form that contains script deactivates the script code. The code is not deleted and can be viewed from within VS.NET, but developers will need to convert the script to C# or VB.NET to maintain the functionality of the form.

XML experience required. Although VB.NET and C# developers will be able to use their preferred programming language from within InfoPath, they still face a learning curve. Unlike Microsoft’s other forms environments (most notably Windows Forms and ASP.NET Web Forms), InfoPath assumes that developers are familiar with important XML concepts, such as schema, namespaces, and the XML Document Object Model (DOM) API. Developers who lack such experience may find InfoPath’s ease-of-use in forms design is more than offset by the complexity of learning XML.

In addition to support for the .NET Framework, the new version of InfoPath provides the following improvements for developers:

  • To prevent accidental data loss, developers can now specify when and how forms are automatically saved
  • Handwritten input can be converted to text on Tablet PC
  • Forms used with BizTalk can change dynamically, depending on the user’s role.

Further Improvements Unlikely until Office 12

At its heart, InfoPath 2003 and the rest of the Office 2003 suite are based upon older technologies such as scripting and Visual Basic for Applications (VBA).

Although tools such as the InfoPath 2003 Toolkit and the previously released Visual Studio Tools for Office offer some level of support for the .NET Framework and managed code, they are constrained by the underlying technology gap between VS.NET and Office. Until Office is rearchitected to directly support the .NET Framework and managed code, developers and IT planners will have to decide whether the benefits of using languages such as C# and VB.NET with Office are worth the additional complexities.

Resources

The update to InfoPath will be included as part of Service Pack 1 for Office 2003, due in June, but preview versions of both the InfoPath update and the VS.NET extensions are available now.

InfoPath 2003 Service Pack 1 Preview can be downloaded from www.microsoft.com/downloads/details.aspx?Familyid=D5ADC839-73F4-4299-ABA0-E88C90B25144&displaylang=en.

InfoPath 2003 Toolkit for Visual Studio .NET Preview is available at www.microsoft.com/downloads/details.aspx?FamilyId=7E9EBC57-E115-4CAC-9986-A712E22879BB&displaylang=en.

For background information on InfoPath and Office 2003, see "Office 2003: XML Support Paves Way for Smart Client" on page 10 of the Sept. 2003 Update.