| |
So You Want To
Be an InfoPath Developer
… -
George Wesolowski
There’s a widely-held belief in the Microsoft
development community that InfoPath forms development requires
little or no development effort. Granted, building the simplest
data entry form with InfoPath requires no coding and is little
more than a “drag-and-drop” exercise. However, to reap the full
benefits of InfoPath such as SharePoint, BizTalk, and Web Services
integration requires custom programming and specialized knowledge
in the following areas:
XML, XSD,
XSLT
At its core, InfoPath is a
desktop application that is part of the Office suite that is used
to build dynamic Windows forms based on XML. When a form is filled
out and saved, data is stored in an XML document. This XML is
defined and constrained by a schema definition stored in an XSD
file. The InfoPath application generates an XSL transform, or
XSLT, which is used by InfoPath to generate the view of the form.
This transform may be modified to extend InfoPath by generating
visual form elements that are not provided by InfoPath.
Familiarity with XML, XSD schemas, and XSLT transforms is
essential to understanding the basics of declarative InfoPath
programming.
Programming business logic with JScript and
VBScript
While other Office 2003 applications provide VBA as the
programmatic interface for customization, InfoPath 2003 provides
the Microsoft Script Editor (MSE) as the programming environment.
This provides the programmer with the choice between JScript and
VBScript as the primary programming language. Event handlers may
be created that allow the programmer to write custom script code
to respond to certain events such as form load and data validation
events.
The InfoPath Object
Model
In addition to providing event handlers,
InfoPath 2003 offers a COM-based programmatic object model that is
used to interact with InfoPath forms and their underlying XML,
XSD, and XSLT documents. At the root of the object model is the
Application object which provides access to other primary objects
such as Window, which is the primary access to the user interface,
and XDocument, which provides access to the XML
form.
XMLDOM
The XDocument object provides a DOM property
which provides the XMLDOM interface on the document. This allows
programmatic access to XML nodes, elements, and attributes in an
interface that is familiar to all .NET XML programmers.
Familiarity with the XMLDOM is essential for programmatically
accessing the underlying XML document of an InfoPath
form.
Integration with Visual Studio
2003
In addition to the COM-based object model,
InfoPath 2003 Service Pack 1 and later provides integration with
the Visual Studio 2003 IDE. This allows programmers to use managed
.NET code instead of script to develop and extend InfoPath forms.
To do this requires installation of the Microsoft Office InfoPath
2003 Toolkit for Visual Studio .NET, which is available as a free
download from the InfoPath Developer Center on the MSDN web site.
By using managed .NET code in the language of choice (C#, VB.NET,
etc.), programmers can take advantage of all the features of the
.NET Framework and the Common Language Runtime (CLR) as well as
the robust debugging environment provided by the Visual Studio
IDE.
Connecting to external data sources using
ADO.NET
InfoPath forms provide an ideal mechanism for
consuming data from external data sources such as databases and
web services. This requires a working knowledge of ADO.NET and SQL
to connect to relational databases, execute queries and stored
procedures, and return recordsets. In addition, a basic
understanding of web services is required to make connections and
to submit and retrieve data to and from web
services.
Conclusion
Microsoft provides full programmatic support for
InfoPath using both legacy COM and ActiveX technologies as well as
current managed .NET code. And, because InfoPath is based on XML
standards, knowledge of XML schema validation, XSL transforms, and
the XMLDOM is required to extend InfoPath forms.
In short, working knowledge
of the core Microsoft technologies such as the .NET Framework,
XML, SQL, and web services is required to do custom InfoPath forms
development using InfoPath 2003. Building customized applications
with InfoPath is not a “drag-and-drop” exercise!
|