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
$column.Update()
$list.Fields.Delete($column)
}
}
}

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



Thursday, January 15, 2015

InfoPath: Some external data was not retrieved. The form will load without the requested data.

When moving your InfoPath form through Dev/Test/Prod, if you have an InfoPath data connection that is referencing a list (and querying that data connection like populating a dropdown), InfoPath winds up storing the GUID of that list in some of it's queries.  So if the list GUIDs don't match then you might get a message like this:


If you just recreate the data connection in InfoPath, then this message should go away.