I have the following code to create a list, however I need to increase via powershell the maxlength of one column

$spWeb = Get-SPWeb -Identity http://ost-dev1.ciredev1.local
 $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::GenericList 
 $spListCollection = $spWeb.Lists 
 $spListCollection.Add("ExternalSites","External Sites",$listTemplate)
 $spList = $spWeb.GetList("/Lists/ExternalSites")
 $spFieldType = [Microsoft.SharePoint.SPFieldType]::Text 
 #$spList.Fields["ExtSiteUrl"].Title = "External Site Url"
 #$spList.Fields["ExtSiteDescription"].Title = "External Site Description"


1 Answer 1


Do you try to use something like this?

$spField = $spList.Fields["FieldName"]
$spTextField = $spField -as [Microsoft.SharePoint.SPFieldText]
$spTextField.MaxLength = 128
  • 1
    it doesnt work with text fields, apparently the field text is only maximum 255 chars, when I changed to Note, it works pretty well. Mar 5, 2012 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.