7.07.2014

SharePoint 2010 - Change Column Types

Sometimes InfoPath doesn't promote fields they way you would like to the SharePoint list. For instance, currency is promoted to a list as a decimal, or a decimal is promoted as an integer. Powershell to the rescue!

Output all of the list columns
$w = Get-SPWeb "https://site";   
$l = $w.GetList("https://site/listname/");
$l.Fields | sort StaticName,Type | ?{$_.CanBeDeleted -eq $true -and $_.Hidden -eq $false} | FT Title,StaticName,Type;


Change Column Type
$w = Get-SPWeb "https://site";   
$l = $w.GetList("https://site/listname/");
 
$column = $l.Fields["Amount Due"];
#$column.AllowDeletion = $false;
#$column.Sealed = $true;
$column.Type = "Number";
$column.Update($true);
$web.Dispose();