Welcome to TechNet Blogs Sign in | Join | Help

SharePoint Shenanigans

Blair Bigger [MSFT]
Help I've renamed a Hidden MOSS Site Column!

One of my customers recently found that someone in the process of working with SharePoint Content Types had renamed one of the built-in Site Columns - Title - to something else… If you attempt to change the Site Column back to "Title" you get this error message:

"The column name that you entered is already in use or reserved."

This is discussed in the following KB Article:

Error message when you try to change the name of a site column back to its original name in Windows SharePoint Services 3.0: "The column name that you entered is already in use or reserved." http://support.microsoft.com/kb/923589

In the article there is an example of C# code to programmatically access the Field object in question and change the name back to the correct/desired name. Let's see if we can make this short and sweet with PowerShell…

I've got PowerShell installed on one of the members of my Farm so that I have easy access to the SharePoint object model.

# First we need to tell PowerShell how to use SharePoint objects:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

# Next we create a site object by created a variable and providing the URL of the site in question.
$site=[Microsoft.Sharepoint.SPSite]("http://<your site>")

# Next we create a web object and open it from the site.openweb method
$web=$site.openWeb()

# Next we create a field object and site it to the name of the field that we want to correct - in this case: Title
$fld = $web.Fields.getFieldByInternalName("Title")

# Next we set the Field object's Title attribute to the name we want to be displayed, again in this case: Title
$fld.Title = "Title"

# Next we tell SharePoint that we want this change to apply to all Lists
$fld.PushChangesToLists = $true

# Finally we make the change official.
$fld.Update()

PowerShell for Windows 2003 SP1 can be downloaded from here:

X86 - http://go.microsoft.com/fwlink/?LinkID=75790&clcid=0x09
X64 - http://go.microsoft.com/fwlink/?LinkID=75791&clcid=0x09

If you've gotten daring and are playing around with MOSS SP1 on top of Windows 2008 - PowerShell is simply a one-line command from the Windows 2008 Command Prompt:

ServerManagerCmd -i PowerShell

Hope this helps!

Posted: Thursday, January 10, 2008 4:35 PM by blairb

Comments

melissavegter said:

I tried these steps (much simpler and more logical than the C# steps) as administrator (full rights) and I recieve the following error:

Exception calling update with ("0") arguments: Access is denied.  (Exception from HResult: 0x80070005 E_AccessDenied.

Any thoughts on what is causing this?  I really like this method....

# September 5, 2008 4:43 PM
Anonymous comments are disabled
Page view tracker