How to change the site column group name

Posted on

This question comes from Twitter from: Kyle Redddock, @WinPhanKyle

He wanted to know how to change the group name of the site columns through central admin.

 

This is not possible through central admin but its pretty easy through powershell.

The first thing you have to know is that you can not create a group of columns, the group name is actually a property of the site column itself, and once you change all the group names of your site columns, then you will all the columns grouped under a different group (if that makes sense)

 

$site = new-object Microsoft.SharePoint.SPSite(“http://xxxx:4000”);

$site.rootweb.Fields[“TheColumnName”].Group = “TheNewGroupTitle”;

$site.rootweb.Fields[“TheColumnName”].Update();

Advertisements

5 thoughts on “How to change the site column group name

    WinPhanKyle said:
    January 7, 2014 at 6:43 pm

    I am trying to automate this script using the following:

    $site = Read-Host “Enter the Site Collection URL”
    $columnname = Read-Host “Enter the column name you want to update”
    $grouptitle = Read-Host “Enter new Group Title”

    Get-SPContentDatabase -Site $site

    $site.rootweb.Fields[“$columnname”].Group = “$grouptitle”;

    $site.rootweb.Fields[“$columnname”].Update();

    When running it, I am getting the following error:

    Cannot index into a null array.

    Any idea?

    Esteban V responded:
    January 7, 2014 at 6:45 pm

    you can not use “” when you are using variables!

      WinPhanKyle said:
      January 7, 2014 at 6:48 pm

      So I removed the “” from the script….still same error.

    WinPhanKyle said:
    January 7, 2014 at 6:52 pm

    Got it to work now. Thanks again for the help!

    Joel Turan said:
    November 26, 2014 at 12:00 am

    I wanted to say thanks for the post and also share a little something extra. I included the commands in this post in a script that imports the variables from a csv. It was quick to make a csv by just copying and pasting the columns directly from the Site Settings->Site Columns page into Excel and saving it as csv. Then just update the path to where you saved the csv, save the script as a ps1 and run it.

    $path = “c:\temp\columns.csv”
    Import-csv -Path $path |
    foreach-object `
    {
    $site = new-object Microsoft.SharePoint.SPSite(“https://411.idealcu.com:443”);
    $site.rootweb.Fields[$_.columnname].Group = “Ideal CU Custom Columns”;
    $site.rootweb.Fields[$_.columnname].Update();
    }

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s