Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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"

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Do you try to use something like this?

$spField = $spList.Fields["FieldName"]
$spTextField = $spField -as [Microsoft.SharePoint.SPFieldText]
$spTextField.MaxLength = 128
share|improve this answer
it doesnt work with text fields, apparently the field text is only maximum 255 chars, when I changed to Note, it works pretty well. – Esteban V Mar 5 '12 at 10:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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