Skip to main content
1 of 2
kaz
  • 167
  • 1
  • 5
  • 14

Changing Column Settings for a Content Type using Powershell

I'm trying to change the setting of a column to make it not a required field. This is the code I'm using:

$site = new-object Microsoft.SharePoint.SPSite("abc.com") $web = $site.OpenWeb()

$MyContentType=$web.ContentTypes["ContentType"] $MyField=$MyContentType.Fields | Where {$_.Id -eq $web.Fields["Column"].id} $MyContentType.FieldLinks[$MyField.Id].Required=$False

$MyContentType.Update()

But this is giving error that $MyContentType.FieldLinks is NULL. How can I successfully execute my powershell?

kaz
  • 167
  • 1
  • 5
  • 14