Tuesday, October 22, 2013

Updating where an InfoPath form is looking for the Data Connections – without having to recreate them

I'm using UDCX's in my InfoPath forms and have previously written a post on ho to programmatically update them. But you still need to update the Location in the InfoPath form. So I thought I'd do a quick post of how to do this without having to delete them and recreate them as this also removes any filtering and binding etc.

Essentially, what you need to do is extract the files from .xsn, modify manifest.xsf and repackage as cab file then rename back to a .xsn. I found the best cab maker to use is PowerArchiver. It's got a nice user interface and is easy to use.
  1. Using any extraction software (7zip, WinZip, PowerArchiver etc)
  2. Right Click on manifest.xsf and select Open With, then select Notepad

  3. Click Edit and Select Replace
  4. In the Find and Replace dialog box, Enter the older URL in find and enter the url to the new Site collection in replace, then click Replace All
  5. Click File and Save
  6. Open PowerArchiver
  7. Click New Archive
  8. In the New Archive Dialog Box navigate to where you want to save the Form, Enter a file name Select .CAB in the Save as Type. Then click Save
  9. In the Add dialog box, change the location to where you originally extracted the .xsn, then select all files and click Add
  10. Close PowerArchiver
  11. Navigate to where you saved the cab right click the cab file and select Rename change the file extension from .cab to .xsn then click enter, click Yes on the renamed extension warning.
  12. Right Click the form and Select Design
  13. In the Ribbon Click the Quick Publish Icon
  14. In the Save Form Dialog box, Select a suitable location to save the form and click OK
  15. When the form has been successfully published, click ok.

The form will now be published to the new location, using all of the udcx's in the new site collection.

1 comment: