I have the following script:
$site = new-object Microsoft.SharePoint.SPSite("http://TEST123") $web = $site.OpenWeb() $ct=$web.ContentTypes("MyCT") $field = $ct.Fields.GetFieldByInternalName("AddTESTColumn") $ct.FieldLinks($field.id).DisplayName ="AddTESTColumn" $ct.Update();
I've used the above to update the full name of a column associated with CT.
But now, I want to update a field of choice column to add a new choice "far" to the current choices tried to use the choice.add but continue to get an error message
I used the following:
$site = Get-SPSite -Identity "http://TEST123" $web = $site.RootWeb $field = $web.Fields("AddTESTColumn"); $field.choices.add("away") $field.update();
and get the following message:
You can not call a method on a NULL value expression.
the problem is with
$field = $web.Fields("AddTESTColumn"); as its not recognizing the name of the same field if it exists. I've used both the internal name and the display name, the same problem.