News, tips, tricks, products releases, updates....

... from ClearPeople's SharePoint Team, the SharePoint People.

08 March 2010

InfoPath fix in SharePoint

Here’s a simple, although tedious, fix to a SharePoint InfoPath problem I came across while working at a client site.
I began to notice that when publishing to any of the organisations three servers, if I add a new field to a form, or even modify the schema in the slightest, SharePoint ‘loses’ the content of the cells.
After looking into the problem a bit, it seemed that the cause is that site columns become duplicated during the publishing of an Infopath Form to Forms Services using the InfoPath Publishing Wizard.

The best way to handle this problem is to use Sharepoint Manager 2007 to identify duplicated site and list columns for the Infopath Form list.

The columns being used by a published Infopath form can be identified by opening the Manifest.xsf for the Infopath form and comparing the columnId values to the Id values obtained by using Sharepoint Manager 2007...see, not too bad!



From here, you need to delete the duplicated site columns using the SharePoint site column administration web page.

And also delete the duplicated list columns on the Infopath Form list using Powershell. Just make sure that all the read only columns are set to ‘false’.




For my specific problem, I used the following Powershell.
function Delete_SPFields_From_SPList_Forced([string] $ServerName, [string] $ListName, [string] $FieldGUID){
$spsite = new-object Microsoft.Sharepoint.SPSite($ServerName + $SiteCollectionName);
# Open A Subsite Of The Site Collection. $web = $spsite.RootWeb; $list = $web.Lists[$ListName]; $fieldCollection = $list.Fields; $guid = new-object System.Guid($FieldGUID); $field = $fieldCollection[$guid]; Write-Host “Removing $field $FieldGUID from $Web $ListName” $field.ReadOnlyField = $false; $field.Update(); $fieldCollection.Delete($field.InternalName); $spsite.Dispose();
}
To delete the following fields.
Claim Date 8b4ddc90-5190-4235-bda4-b46ca6c061b1Claim Grand Total 64a160d0-ee6d-4d8f-b383-e5eaf11ecc6fClaim No 83d5c76c-4520-4045-a819-b47bac301e95Claim Status 1db7b23f-e971-447b-b47f-59d9dc6d143cClaimant Name f004b61e-8cea-4fdc-a415-43a42097f751Mdr StaffNo 1f26b5b5-0b71-4ea4-94ee-77ed5ded220c
And all was then good!
Useful references during the trouble-shooting.

http://www.delphi-ts.com/blogs/lozzi/post/2009/06/03/Duplicate-site-columns-in-MOSS-from-InfoPath-Forms.aspx
http://blumenthalit.net/Files/PowerShell%20Scripts/Delete-SPField.ps1
http://pholpar.wordpress.com/category/custom-fields/

Also, if this helped, let us know!

No comments: