Tag Archives: XSN

InfoPath – search replace URLs within XSN

Need to migrate forms to another URL?   But not sure how to update many data connections?  Try the script below.

This PowerShell will extract XSN contents to a folder, execute string search replace, and “package” back into CAB format with XSN extension.   A simple way to migrate InfoPath forms to another DNS name for scenarios like AAM Alternate Access Mapping redirection and SharePoint major version upgrade (2007 > 2010 > 2013).

Enjoy!  shades_smile

 

NOTE – Requires CABARC.EXE  http://stackoverflow.com/questions/3361928/where-can-i-get-the-cabarc-utility

 

InfoPath_UpdateDataConnetions.ps1

# Update InfoPath form URLs by extracting CAB and performing search replace
Param(
	[string]$xsnFile
)
Write-Host "Prepare folders..."
md c:\InfoPath\before
md c:\InfoPath\temp
md c:\InfoPath\after
Write-Host "Clean temp..."
Remove-ChildItem c:\InfoPath\temp\*.* -Recurse
Write-Host "Extract XSN... $xsnFile"
cabarc x "c:\InfoPath\before\$xsnFile" *.* c:\InfoPath\temp\
Write-Host "Replace URL..."
$txt = Get-Content c:\InfoPath\temp\Manifest.xsf
$txt |% {$_ -replace "//sharepoint/" "//sharepnt07/"} | Out-File -FilePath "c:\InfoPath\temp\Manifest.xsf" -Encoding UTF8 -Force
Write-Host "package XSN..."
cabarc n "c:\InfoPath\after\$xsnFile" c:\InfoPath\temp\*.*
Write-Host "DONE"

 

InfoPath – sample XSN form templates (2007, 2010, 2013)

Below are example form templates from InfoPath 2007 upgraded to the newer 2010 and 2013 versions.  With InfoPath Designer/Filler on the desktop as separate applications these templates were removed.   Hopefully these are helpful to those working on InfoPath 2010 and 2013 for quick start.

 

image

 

NOTE – There has been a lot of talk recently about InfoPath going away.   While that may happen over time, there are still thousands of live forms in production today SharePoint admins must support.   As long as Microsoft includes InfoPath in the Office suite I believe there will be many scenarios where InfoPath makes sense.   Complete an expense report and submit for approval?   Done.  One hour with InfoPath Designer and SharePoint Designer.  No code.  Anyone can support.  Just my two cents.

Return to Top ▲Return to Top ▲