Tuesday, July 7, 2009

Using Data Connection Library with InfoPath

This is to move data connections of InfoPath form into SharePoint “Data Connection Library”. This will save lot of effort while republishing form. If we use this technique no need of change data connection URLs of the InfoPath form while publishing from one server to into another server( say development to production).

Moving InfoPath Data Connections into Data Connection Library:

1. Create a Data connection library( Site Actions -> Create -> Select “Data Connection Library” )

2. Give name and copy newly created “Data Connection Library” URL, e.g.: http://idc-lt-i00142/sites/test/DataConnections

3. Open InfoPath from in design mode open data connections( Tools => Data Connections)
4. Select Data connection which needs to move to the “Data Connection Library” and click “Convert” button.

5. Give previously created “Data Connection Library” name append with name of the data connection(Any name). e.g. http://idc-lt-i00142/sites/test/DataConnections/MainSubmit
6. Select “Relative to Site Collection” radio button and click OK.

7. This will create an entry in previously created “Data Connection Library” and the InfoPath form always check the data source path from “Data Connection Library” with same name in the same site level.

Deploying Data Connections from one site to another site ( say development to production).

These steps to be done when a site is moving from one place to another. These is one time process, no need to repeat this on each publish of the form. Form always reads Data Source path from corresponding “Data Connection Library”.

1. Move data connection library into the destination site collection into the same level. This can be done either by restoring site backup or by creating List Template of with data and create new data connection library in the destination site at same level.

2. Open each item( .udcx files) in the destination “Data Connection Library” in any xml editor( notepad or Visual Studio etc) ( Action -> Open in windows explore -> copy to local drive -> open.)

3. Change the data connection URLS in the .udcx files save and upload again.
e.g.
Update ” http://SourceServer/sites/site/FromLibrary” in “ http://SourceServer/sites/site/FromLibrary ” to http://DestinationServer/sites/site/FromLibrary

Repeat this for all data connection library.

4. So in the new site InfoPath always refer new Data Connection library in the newly added site.

2 comments:

Raj said...

Hi shaiju,

I am working on InfoPath and connection files. I totally agree for the information that you shred. However, i am facing a problem when my dev server URL structure and prod server URL structure differs.

for example

in my dev server, i had my connection library in this url

http://webapp/sites/sitecollection1/connectionlibrary/

in my prod server, i had my connection library in this url

http://webapp/department/sites/sitecollection1/connectionlibrary/

In this case my InfoPath failes in getting connected to udcx files.

i observed, when you publish form in dev environment, in .xsn it will be hardcoded with '/sites/sitecollection'. This is the cause of the issue.


any advice how to make the form always refer to connection library in that site collection only.

Vijay_raj.com said...

Good job .Also i like ebokk gallery