574 18.4 Data Connections
instance, it would make sense to create a template part containing all the
appropriate address fields and then insert this template part into each of the
form templates that needed that information.
18.4 Data Connections
InfoPath form templates contain one or more connections to data sources.
The default data source is the main data source and stores the data entered
onto the form by the user. Additional secondary data sources can be associated
with the form to help populate controls on the form, such as a drop-down
list box. For example, you could have a list box on your form that retrieves its
contents from a SharePoint list when the form is opened.
Data sources are configured through the use of data connections, which
are also referred to as query connections. The data connections can be stored
directly with the form template, or they can be stored in a Data Connection
Library. A Data Connection Library (DCL) is a special type of document
Figure 18.10
Controls filtered on
compatibility
settings.
18.4 Data Connections 575
Chapter 18
library that comes with SharePoint Server 2007 and is used to store data con-
nection files. Two types of data connection files can be stored in the DCL: an
Office Data Connection (ODC) file and a Universal Data Connection
(UDC) file. InfoPath form templates use UDC-type data connections, and
the files generally have a .udcx or a .xml extension. Figure 18.11 shows the
contents of a UDC file generated by InfoPath 2007 and stored in a local
DCL in a SharePoint site. This specific data connection only retrieves infor-
mation from the SharePoint list; it does not update data in the list.
The UDC file format has been around since FrontPage 2003. If you
browse the Microsoft site for information on the schema, you will find that
there are actually two versions of the UDC file format; InfoPath uses the
V2.0 version. If you want to create a UDC data connection file for use with
InfoPath form templates, you can build the .udcx file from scratch using
Notepad and the examples provided by MSDN, or you can leverage the Data
Connection Wizard that comes with InfoPath 2007 (Figure 18.12). The
Data Connection Wizard provides tools with which you can set up the con-
nection and store it directly with the form template. The wizard extracts all
the relevant information needed to perform your query.
You can then use the wizard to convert this data connection into a UDC
file and store it directly into a DCL on the SharePoint server (Figure 18.13).
If you can store the connection information with the form template, why
would you want to go to the bother of creating a UDC file? One of the main
Figure 18.11
Universal data
connection
(.udcx) file.
576 18.4 Data Connections
advantages of using UDC files to store data connection information is that it
allows you to share the same data connection information among many form
templates, without requiring each template to hold its own copy of the con-
nection data (as was the case with InfoPath 2003). It also greatly improves
the maintenance and upkeep of connection information; should the data
source move, you only have to update the data connection information in
one file instead of editing each form template that leverages the data connec-
tion. Additionally, data connections stored in a UDC file support cross-
domain connections, which means that you can connect to data outside of
the current domain boundary. Such connections are not possible unless the
data connection uses a UDC file. Figure 18.14 shows the error displayed to
the user when a form template attempts to make a cross-domain connection
without the use of a UDC file. If we were to replace the data connection
causing the error with a data connection that uses a UDC file, we would still
receive this error if the cross-domain access setting in the Forms Services con-
figuration settings was not enabled. This setting is disabled by default. How-
ever, remember that if you enable cross-domain access for user form
templates, it applies to all user form templates, which if misused has the
potential to cause unscheduled downtime. If your form template needs to
make a cross-domain connection, you should either make the template a
fully trusted form template or ask your administrator to create a data connec-
tion in the centrally managed connection library.
Figure 18.12
Data Connections
Wizard.
18.4 Data Connections 577
Chapter 18
When you convert a data connection into a UDC file you are given the
option of selecting the connection link type. The connection link type to the
Figure 18.13
Convert data
connection to
UDC file.
Figure 18.14
Cross-domain data
connection error.

Get Microsoft SharePoint 2007 Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.