Manage data connection files for InfoPath Forms Services (SharePoint Server 2010)

 

Applies to: SharePoint Server 2010

Forms that use InfoPath Forms Services in Microsoft SharePoint Server 2010 can use data connection files to specify settings for connecting to data sources. Data connection files are created and published to data connection libraries by the form designer by using Microsoft InfoPath 2010.

A data connection is a dynamic link between a form template and a data source that stores or provides data for the form template. The main data connection, if present, defines the main data source of the form, which is the XML schema that determines how data is stored. The main data connection is created automatically when you create a form template from a database, a Web service, or by customizing the form for a SharePoint list. The form can optionally have one or more secondary data connections. You can create as many secondary data connections as you want when you design a form template.

A data connection file is an XML file that has a .xml or .udcx file name extension, and that contains connection information for a single external data connection. This file is stored in a data connection library on a server that is running Microsoft SharePoint Server 2010. A data connection file is created by a developer by using an XML editing program, or by an InfoPath forms designer by converting a data connection in an existing form template into a data connection file in Microsoft InfoPath Designer 2010.

Data connection files provide a way for administrators to manage data connections and configure connection settings without modifying and republishing form templates. Data connection files are also used to specify server-specific authentication credentials by using the Secure Store service.

Data connection files can be stored in the same site collection as the form template or in a centrally managed data connection library on the Central Administration site. Data connection files that are stored on individual site collections can be used by forms in that site collection. Data connection files for administrator-approved form templates are stored in a centrally managed data connection library in Central Administration. You can manage this library from the Manage Data Connection Files page or by using Windows PowerShell. Data connection files in this library can be used by administrator-approved form templates. By default, data connection files in this library can only be used by Web browser forms, although farm administrators can decide to allow for HTTP access by clients such as Microsoft InfoPath Filler 2010.

Data connection files can enable connections across servers or outside the farm. This can include settings for the Secure Store service to provide alternative credentials for the connection.

In this article:

  • Types of data connections

  • Create a data connection file

  • Manage the centrally managed data connection files

Types of data connections

InfoPath Forms Services in SharePoint Server 2010 provides several different kinds of data connections. Data connections can be used to query or submit data.

Query data connections

Query data connections are used to query data from external systems to use when filling out a form. Query data connections include the following:

  • Database

  • SharePoint list

  • SOAP Web service

  • Representational State Transfer (REST) Web service

  • XML file

Database data connection

The Database data connection looks up information in a database to populate form fields. You can use this connection to look up data in Microsoft SQL Server. To connect to a different database than a SQL Server database, use a Web service connection.The Database data connection is query-only and cannot be used to submit data to a database. If you want to use a form to submit data to a database, you should use the SOAP Web service data connection.

SharePoint list data connection

The SharePoint list data connection is a query-only connection that is used to populate InfoPath form fields from an existing SharePoint library or list.

SOAP Web service data connection

The SOAP Web service data connection can query data from a SOAP 1.1 Web service and use the return data to update fields in the originating form. To query data by using a REST Web service, use the REST Web service data connection.

REST Web service data connection

The REST Web service data connection is new for InfoPath 2010 and InfoPath Forms Services in SharePoint Server 2010. Form designers can use a rule to add dynamic parameters to the REST URL when the form is filled out.

XML file data connection

The XML file data connection queries an XML file and uses the data from the XML file to populate form fields. This connection type can be used to consume data from any URL that returns data in XML format. Form template designers can also decide to include the XML file in the form template itself, which reduces resource-management issues that might occur when the system connects to an external resource.

Submit data connections

Submit data connections send form data as XML to external systems. Submit data connections include the following:

  • Submit to SharePoint library

  • Submit to e-mail

  • Submit to SOAP Web service

  • Submit by using HTTP POST

  • Submit to hosting environment

Submit to SharePoint library data connection

The Submit to SharePoint library data connection enables forms to be uploaded directly to a SharePoint document library. This connection submits the entire form to the library as an XML document.

Submit to e-mail data connection

The Submit to e-mail data connection uses the SMTP e-mail adapter to submit form data to an e-mail address. The settings of the data connection specify whether to submit the entire contents of the form as an attachment or the current form view as the body of the e-mail message.

Submit to SOAP Web service data connection

The Submit to SOAP Web service data connection can submit XML data from a form to a SOAP Web service. The form ignores any data returned from a Web service submission other than error codes.

This connection can be used to submit all or part of the form’s data as a SOAP message.

Submit by using HTTP POST data connection

The Submit by using HTTP POST data connection enables an InfoPath form to post data to an application server by using an HTTP POST. This connection submits the entire form as an XML document.

Submit to hosting environment data connection

The Submit to hosting environment data connection sends a submit event to the host. The host is then responsible for handling that event and retrieving the data from the form.

Create a data connection file

Form designers create data connections when they design form templates. Data connection settings can be stored separately from the form template in data connection files in a data connection library.

Data connection files are used for the following scenarios:

  • Re-use of data connection settings for multiple form templates

  • Modifying data connection settings after form templates are published without having to republish each form template.

  • Providing server-specific authentication credentials.

To make cross-domain data connection from a Web browser form, data connection settings must be stored in a data connection file in a data connection library. By default, files in a data connection library must be approved before they can be used, by using the content approval feature in SharePoint Server 2010.

To create a data connection file, perform the following procedures:

  1. Create a data connection library to store data connections.

  2. Create a form template.

  3. Add the intended data connection to the form template.

  4. Convert the data connection to a data connection file.

For information about how to create a data connection library, see How To: Create and Use a Data Connection Library (https://go.microsoft.com/fwlink/p/?LinkId=188117&clcid=0x409).

For information about how to create a form template and add a data connection to a form template, see InfoPath Help and How-to (https://go.microsoft.com/fwlink/p/?LinkId=188118&clcid=0x409).

To convert a data connection to a data connection file

  1. Verify that the user account that is performing this procedure is a member of the Site Members SharePoint group, or any other group with the Add Items permission.

  2. In InfoPath Designer 2010, open the form template with the data connection that you want to convert.

  3. On the Data tab, in the Get External Data group, click Data Connections.

  4. On the Data Connections dialog box, in Data connections for the form template, click the data connection that you want to convert.

  5. Click Convert to Connection File.

  6. On the Convert Data Connection dialog box, in Specify the URL of the new data connection file, type the URL specifying the location of the data connection library and the file name for the data connection file.

    Note

    The URL will be in the form https://server/dataconnectionlibraryname/filename.udcx. You can also browse to the library and the file name will be suggested based on the name of the data connection.

  7. Under Connection link type, select one of the following options:

    • To link to a data connection file in the same site collection, click Relative to site collection.

      Note

      This is the recommended option in most cases. The second option is for data connections that are used by administrator-approved templates that are not published directly but must be uploaded by a farm administrator.

    • To upload the data connection file to the library in Central Administration, click Centrally managed connection library.

      Note

      This option is only used for advanced scenarios that use administrator-approved form templates. For this option to work, the farm administrator must copy and upload the data connection file to the centrally managed data connection library in Central Administration. For more information, see the “Manage data connection files in Central Administration” section later in this article.

  8. Click OK.

  9. On the Data Connections dialog box, click Close.

Manage the centrally managed data connection files

Farm administrators upload data connection files to the Manage Data Connection Files library in Central Administration. These data connection files can be used by any form templates that have been uploaded to the Manage Form Templates page in Central Administration. Farm administrators can also perform the following tasks for data connection files:

  • Organize data connection files into categories.

  • Allow HTTP access by clients such as InfoPath Filler.

  • Change the display name and description.

  • Delete data connection files that are no longer needed.

Verify that the user account that is performing the following procedures is a member of the Farm Administrators SharePoint group.

Upload a data connection file

Data connection files in the Manage Data Connection Files library can be used by administrator-approved form templates.

To upload a data connection file by using Central Administration

  1. Verify that you have the following administrative credentials: You must be the farm administrator.

  2. On the Central Administration Web site, in the Quick Launch, click General Application Settings.

  3. On the General Application Settings page, in the InfoPath Forms Services section, click Manage data connection files.

  4. On the Manage Data Connections Files page, click Upload.

  5. On the Upload Data Connection File page, in the Select File section, type a location in the File name text box.

    You can also browse to the location.

    To upload a copy of a data connection file that is stored in a data connection library, browse to the data connection library, click the name of the data connection file in the data connection library, and then click Save in the Choose File to Upload dialog box.

  6. In the Category section, you can specify a category for the file.

    The category name is arbitrary, and does not have to correspond with any formalized schema. Files with the same category name are grouped together.

  7. In the Web Accessibility section, you can click Allow HTTP access to this file to let clients such as InfoPath Filler access the data connection file over HTTP.

    Note

    By default, files that are stored in the centrally managed data connection library can be accessed only by farm administrators, and can be used only by administrator-approved form templates. Other users cannot read or download these files. To enable these files to be downloaded to client computers, select the Allow HTTP access to this file check-box. This enables any user who has the permission to view a form that uses one of these files to download and view the contents of the file.

  8. Click Upload.

To upload a data connection file by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. At the Windows PowerShell command prompt, type the following command:

    Install-SPDataConnectionFile -Path "<FileNamePath>" -Category "<CategoryName>" -WebAccessible <WebAccessibleSetting>
    

    Where:

    • <FileNamePath> is the full path and name of the data connection file to upload.

    • <CategoryName> is the category name. The category can be used to group the data connection files. This parameter is optional.

    • <WebAccessibleSetting> is a Boolean value that specifies whether the data connection file can be accessed by using the HTTP protocol. True to let clients, such as InfoPath Filler, access the data connection file over the HTTP protocol; otherwise, False. The default is False. This parameter is optional.

      Note

      By default, files that are stored in the centrally managed data connection library can be accessed only by farm administrators and can be used only by administrator-approved form templates. Other users cannot read or download these files. To enable these files to be downloaded to client computers, set the WebAccessible parameter to True.

For more information, see Install-SPDataConnectionFile.

Note

We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

Modify the properties of a data connection file

You can modify the properties of a data connection file, such as the display name, description, category, and the Web accessible setting.

To modify the properties of a data connection file by using Central Administration

  1. Verify that you have the following administrative credentials: You must be the farm administrator.

  2. On the Central Administration Web site, in the Quick Launch, click General Application Settings.

  3. On the General Application Settings page, in the InfoPath Forms Services section, click Manage data connection files.

  4. On the Manage Data Connection Files page, click the name of the data connection file, and then click Edit Properties.

  5. Make any changes to the data connection file properties and then click Modify.

To modify the properties of a data connection file by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. To change the description and Web accessible setting of a data connection file, type the following command:

    Set-SPDataConnectionFile -Identity "<FileName>" -Description "Use for the new Marketing server" -WebAccessible $true
    

    Where <FileName> is the name of the data connection file to modify.

For more information, see Set-SPDataConnectionFile.

Note

We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

Delete a data connection file

You can delete data connection files that are no longer needed.

To delete a data connection file by using Central Administration

  1. Verify that you have the following administrative credentials: You must be the farm administrator.

  2. On the Central Administration Web site, in the Quick Launch, click General Application Settings.

  3. On the General Application Settings page, in the InfoPath Forms Services section, click Manage data connection files.

  4. On the Manage Data Connection Files page, click the name of the data connection file, and then click Delete.

  5. On the Delete Data Connection File page, click Delete.

To delete a data connection file by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. At the Windows PowerShell command prompt, type the following command:

    Uninstall-SPDataConnectionFile -Identity "<FileName>"
    

    Where <FileName> is the name of the data connection file to delete.

For more information, see Uninstall-SPDataConnectionFile.

Note

We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

See Also

Concepts

InfoPath Services cmdlets (SharePoint Server 2010)
InfoPath forms administration (SharePoint Server 2010)