0

Following is my script to change display name for a Site Column. However when I look at display name it still remaining unchanged(in Schema). It only updated title not display name.

$w = Get-SPWeb "http://test"
[Microsoft.SharePoint.SPField]$f = $w.Fields.TryGetFieldByStaticName("PublishingRollupImage")

$f.Title = "New Title"; 
$f.PushChangesToLists = $true; 
$f.Update($true);       
$w.Update();

When I try to get the Field using following script the field is null.

 $nf = $w.Fields["New Title"]
  • Do you really try to rename the PublishingRollupImage ? – Stefan Bauer Dec 16 '13 at 10:38
  • Yes, why not? Please let me know why it is not a good idea. – Medes Dec 16 '13 at 12:44
  • 1
    If you overwrite the name of an out of the box column you might get no support by microsoft or it will be overwritten by an update. Another point is that you might mess up other functionalities. In general i would recommend what comes out of the box should be used out of the box. What don't you like about the name publishing rollup image. It describes exactly what it does. You also need consider that some of the fields are sealed or readonly which shouldn't be changed too. – Stefan Bauer Dec 19 '13 at 9:52
1

It was so easy to solve it, here is solution

 [String]$schema = $f.SchemaXml
 $schema = $schema.Replace("old title", "New title")
 $f.SchemaXml = $schema
 $f.Update($true)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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