When migrating InfoPath forms to SharePoint 2010, The first show stopper is: Data connections. Data connections are hard coded in the InfoPath Farm.
Lets say: we are migrating from MOSS 2007 environment (Say: http://MOSS.Company.com) to SharePoint 2010 (Say: Http://SharePoint.company.com). Doesn’t matter whether you Upgrade/Migrate – After the migration all the existing InfoPath Forms will still be pointing to the old URL :http://MOSS.Company.com.. Ouch!
Do we need to go to each and every Form, Change the connection to fix this? OMG! Luckily, SharePoint offers a PowerShell cmd-let to fix this issue: Update-SPInfoPathUserFileUrl
Update-SPInfoPathAdminFileURL -find <OldUURLtoReplace> -replace <NewURL>
In Case, This doesn’t help or Form template is missing then you can upload/publish your new template and re-link them. (Under General Settings, click Relink forms to this form library)
Technet article addressing this issue: http://technet.microsoft.com/en-us/library/cc263286.aspx#FormTemplateLinks
For Admin Approved InfoPath forms, you can use:
stsadm -o exportipfsadminobjects command export the IP forms to a CAB file and then use Import-SPInfoPathAdministrationFiles cmdlet for importing them.
How about Existing Forms (XML Files) Created?
The Update-SPInfoPathUserFileUrl will fix only the Template URL of the FORM Library, But not on the existing XMLs created on the Form Library. The HREF attribute in the existing Infopath XMLs must be changed.
To Fix the existing Forms, We need to Relink them. Just get into Form Library settings >> Relink All
You can get the List of Form Libraries using PowerShell: Find All InfoPath Form Libraries
If you have many Form Libraries and want to update the existing Form’s connections, you can use PowerShell script: https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/update-spinfopathuserfileurl?view=sharepoint-ps