Remove ‘ReadOnlyField’ lock from columns created in InfoPath using PowerShell


Have you ever created an InfoPath Form Template and published fields from the template to SharePoint Columns in your content type?

I’m sure you have, otherwise you probably wouldn’t be reading this.

Essentially, the columns will be grayed out in the list settings:

And if you try to set the value of the field using SharePoint Designer, you won’t see it in your list of available columns:

However, luckily we have PowerShell – and we can simply edit the ReadOnlyField value from $true to $false – thus allowing us to edit this field. Here’s how!

$web = Get-SPWeb http://weburl
$list = $web.Lists["List Name"]
$field = $list.Fields["Field Name"]
$field.ReadOnlyField = $false
$field.Update()
$list.Update()
$web.Update()
$web.Dispose()

After doing so, the column is not only editable in the browser – we can choose it in Designer:

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s