Here i am going to provide a script for set required property for list column.
$web = Read-Host "Enter site URL : "
$spweb= Get-SPWeb $web
Write-Host "Set Required attribute" -ForegroundColor Magenta
$list = $spweb.Lists["List Name"]
$field = $list.Fields["ColumnName"]
$field.Required = $true //if you want to remove the required property give $false
$field.update()
$list.update()
Write-Host "Required attribute enabled" -ForegroundColor Magenta
$web = Read-Host "Enter site URL : "
$spweb= Get-SPWeb $web
Write-Host "Set Required attribute" -ForegroundColor Magenta
$list = $spweb.Lists["List Name"]
$field = $list.Fields["ColumnName"]
$field.Required = $true //if you want to remove the required property give $false
$field.update()
$list.update()
Write-Host "Required attribute enabled" -ForegroundColor Magenta
No comments:
Post a Comment