Partilhar via


Where do UDC files come from?

Where do UDC files come from? - I knew you’d ask. (For those of you who are wondering what a UDC file is, you should go read my post entitled "Making data connections work in browser forms.")

 

There are a couple of ways to go about it. UDC files are just xml files with a specific namespace and schema, so once you have a few examples you can probably get around handily with notepad and cut and paste. However, we’ve made it easier than that with the new Convert functionality on the Manage Data Connections dialog. (For those intrepid souls who prefer the notepad route, a schema reference is being prepared for publication.)

 

If you start out by designing your data connection the way you normally would, you can then use the Convert button to change the connection from settings in the form template to settings in a data connection file. (In fact, you can open any existing form template in InfoPath 2007 and convert existing data connections the same way.)

 

To start with, make sure you have write permissions to a data connection library (henceforth "DCL") on the Microsoft Office SharePoint 2007 server you’re going to publish your form to. Then, using InfoPath 2007 Beta 2 or later, create your data connection or open a form template with an existing data connection. Make sure the connection is to a source supported by UDC. (E-mail connections, connections to a Microsoft Access database, or connections to an XML file in the form template cannot be converted to UDC connections.)

 

Here’s the data connections dialog showing a few connections I threw together (you can get to this dialog off of the "tools" menu in InfoPath design mode):

 

 

Click the Convert button and specify the path to your data connection library. If you click "Browse...", InfoPath will suggest a filename based on the name you gave the data connection when it was created.

 

 

If you choose a data connection file that already exists, InfoPath will use the settings in the file you chose - don’t expect it to overwrite the original file with new settings. This could have unexpected results if the file that’s already in the library is a different connection type or returns data that does not conform to the schema your form template expects.

 

For most cases, you want to leave the default connection link option. Choosing "centrally managed connection library" will cause InfoPath and Forms Services to look for the UDC file in the "Manage data connection files" library in SharePoint central admin. This is fine, but it means that you need to copy the file from the DCL where you created it to that location before you can use it. This presumes you have access to SharePoint Central Admin. See my last blog post entitled "Making data connections work in browser forms" for more information on this option.

 

Once you click "OK" on this dialog, your UDC file will be created and saved to the location you specified, and the connection in the form template will be modified to retrieve settings from the UDC file rather than from the form template.

 

NOTE: There’s a known issue in the Beta 2 release where you will see an "invalid URL" dialog at this point. This is benign and is no longer seen in the technical refresh.

 

You now have a UDC file in your DCL, but you’re not quite done. By default, a DCL will require content approval before anyone other than the file’s owner can use the UDC file you uploaded. Unless the content approval requirement has been removed, a site administrator or someone else with the content approval right will need to set the file’s status to "approved."

 

Adding Authentication

InfoPath does not automatically configure server-only authentication options for you. However, when creating a UDC file, InfoPath automatically creates an authentication block within the UDC file that is preconfigured to use Office Single Sign-on. In order to use this authentication option, you’ll need to uncomment the authentication block within the file and add both the SSO application ID and the CredentialType. Most of the time, you’ll want to use the SSO credential to log onto Windows, for which you’ll need to specify "NTLM" as the CredentialType. The full list of possible credential types is as follows:

 

Value Description
Sql Credentials will be embedded in a database connection string for authentication against a SQL server.
NTLM Credentials will be used to impersonate a Windows user
Kerberos Credentials will be used to impersonate a Windows user using Kerberos
CD The username will be used to impersonate a Windows user using Constrained delegation
Basic Credentials will be used to perform HTTP Basic authentication
Digest Credentials will be used to perform HTTP Digest authentication

 

Reusing existing UDC files

Once you’ve created your UDC file, you may want to use the same connection for other form templates. Among other things, this has the benefit of sharing settings for multiple forms in a common location. Changing the settings in the UDC file will cause all of the related forms to pick up the changes the next time they are used.

 

There are several places in InfoPath where we expose the ability to re-use data connection settings exposed as UDC files in a data connection library. Here are a few examples:

 

 

 

 

All of these entry points lead to this dialog:

 

 

When you specify one or more SharePoint sites to search, this dialog allows you to browse available UDC files containing in DCLs on those sites. Based on the context, this dialog is filtered to show only applicable connections (for example, if you start from the "Design a form" dialog, this dialog will only show Web service and database connections).

 

Once you’ve specified the UDC file to use, you may need to specify some properties for the connection that are not contained in the file (for example, for a SharePoint list connection, you’ll be asked to specify which columns to include in the data source), but otherwise, you’re done.

 

- Nick Dallett

Program Manager

Comments

  • Anonymous
    October 05, 2006
    Thanks for this great post, Nick. The question was once on my lips. Now you've grabbed an article away from me. :)

  • Anonymous
    December 05, 2006
    Today I needed to get an InfoPath Forms Services web-form to make a call out to a web service. I was

  • Anonymous
    December 20, 2006
    Encontrei num post do blog do JOPX , este conjunto de recursos sobre InfoPath 2007. General resources

  • Anonymous
    December 25, 2006
    InfoPath 2007 resources General resources InfoPath General Overview InfoPath team Blog Designing Form

  • Anonymous
    May 22, 2007
    Hi, I have to admit that this post is long overdue. In the last two weeks, I came across a lot of people

  • Anonymous
    May 22, 2007
    Hi, I have to admit that this post is long overdue. In the last two weeks, I came across a lot of people

  • Anonymous
    August 19, 2008
    Hi, It's been a while since I posted. As you may imagine, July wasn't the most popular month

  • Anonymous
    December 16, 2009
    I did everything above but I am now recieving an error (An error occurred accessing a data source.) and my fields using this data connections are not populated. Before I did this it worked correctly. Do you know what I may have done wrong or need to do to correct it? Thanks!

  • Anonymous
    July 30, 2010
    Awesome post. Thank you very much for your help on UDC file creation and its impact on SharePoint/Infopath.

  • Anonymous
    June 04, 2014
    Thank you for this article! Looked all over for a good explanation on how to create UDCX data connection files and why I could not see them in InfoPath designer. And here it is!!! :)