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."

Article translations Article translations
Article ID: 923589 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

You connect to the Site Column Gallery page of a site in Microsoft Windows SharePoint Services 3.0, and then you rename a site column. For example, you rename the Department site column. When you try to change the name of the site column back to its original name, you receive the following error message:
The column name that you entered is already in use or reserved

CAUSE

This issue occurs if the following conditions are true:
  • You rename an out-of-the-box site column.
  • Another column or field in Windows SharePoint Services 3.0 uses the same display name as the site column that you renamed.
For example, the Department site column and ol_Department field both use Department as the display name.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To work around this issue, use the Windows SharePoint Services 3.0 object model to programmatically reset the display name of the column. The following is sample code that you can use to do this.
using System;
using System.Globalization;
using Microsoft.SharePoint;

public class RenameField
{
    public static void Main(string[] args)
    {
        int i = 0;
        string strWebUrl = string.Empty;
        string strFldInternal = string.Empty;
        string strFldDisplay = string.Empty;
        while (i < args.Length - 1)
        {
            switch(args[i].ToLower(CultureInfo.InvariantCulture))
            {
                case "-url":
                case "/url":
                    strWebUrl = args[++i];
                    break;
                case "-fld":
                case "/fld":
                    strFldInternal = args[++i];
                    break;
                case "-display":
                case "/display":
                    strFldDisplay = args[++i];
                    break;
                default:
                    break;
            }
            i++;
        }
        if (string.IsNullOrEmpty(strWebUrl) ||
            string.IsNullOrEmpty(strFldInternal) ||
            string.IsNullOrEmpty(strFldDisplay))
        {
            PrintHelp();
            return;
        }
        SPSite site = new SPSite(strWebUrl);
        SPWeb web = site.OpenWeb();
        SPField fld = web.Fields.GetFieldByInternalName(strFldInternal);
        fld.Title = strFldDisplay;
        fld.PushChangesToLists = true;
        fld.Update();        
    }

    private static void PrintHelp()
    {
        Console.WriteLine("Reset the display of a field template " + 

                    "on the specific SPWeb:\n\n" +

                    "RenameField -url <absoluteWebUrl> " +

                    "-fld <FieldInternaName> " +

                    "-display <NewDisplayName>");

            
    }
}

MORE INFORMATION

For more information about the Windows SharePoint Services 3.0 object model, see the Windows SharePoint Services 3.0 SDK. In order to view the Windows SharePoint Services 3.0 SDK, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/ms441339.aspx
Or, to download the Windows SharePoint Services 3.0 SDK, visit the following Microsoft Web site:
http://www.microsoft.com/downloads/details.aspx?familyid=05E0DD12-8394-402B-8936-A07FE8AFAFFD&amp;displaylang=en

Properties

Article ID: 923589 - Last Review: June 26, 2007 - Revision: 2.0
APPLIES TO
  • Microsoft Windows SharePoint Services 3.0
Keywords: 
kbbug kbpending kbexpertiseinter kbtshoot kbprb KB923589

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com