How to make SharePoint list column read only with PowerShell?
Start SharePoint Management Shell as Administrator
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Web
$web = Get-SPWeb http://SiteName
#Get the List
$List = $Web.Lists["ListName"]
#Get the Field
$Field = $List.Fields["FieldName"]
#Set the field to Read only
$Field.ReadOnlyField = $true
$Field.Update()
Start SharePoint Management Shell as Administrator
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Web
$web = Get-SPWeb http://SiteName
#Get the List
$List = $Web.Lists["ListName"]
#Get the Field
$Field = $List.Fields["FieldName"]
#Set the field to Read only
$Field.ReadOnlyField = $true
$Field.Update()
No comments:
Post a Comment