Thursday, January 29, 2015

Remove the grayed out columns created by InfoPath that are not mapped to SharePoint columns

Sometimes when you map InfoPath columns to SharePoint columns, if you switch environments and the column IDs don't match up you'll get grayed out columns in addition to your SharePoint columns:

You can go back into InfoPath and under Form Options -> Property Promotion, go through and map each column to the proper SharePoint content type and column that you created, and re-publish the InfoPath form.  Then run the following:

$web = Get-SPWeb -identity http://webapp/site
$list = $web.Lists["LISTNAME"]
foreach($column in $list.Fields)
if ($column.Group -eq "Microsoft Office InfoPath")
if ($column.ReadOnlyField -eq $true)
Write-Host $column.Title
$column.Hidden = $false
$column.ReadOnlyField = $false

and you'll remove the extra columns and your InfoPath data should be mapped to your SharePoint columns properly.

No comments: