5

I am working on a sharepoint server 2016 on-premise. I have the following scenario, which I can not understand:-

  1. Using the UI from "Site settings" >> "Site columns". I created a new site column named ITDepartmentOwner.
  2. Now I got a new site column with the following properties:-
    • Display & Internal Name = ITDepartmentOwner.
  3. now using the UI I rename the site column to be IT Department Owner by adding white spaces between the words.
  4. now the column properties are as follow:-
    • Internal name did not change = ITDepartmentOwner
    • Display name = IT Department Owner .

now I do understand that modifying a column name will only affect its display name while the internal name will not get changed, and this is fine. but the problem I am facing is that, when I try to rename my site column to be Owner, I got the following error:- enter image description here

So I am not sure why I got this error. Now SharePoint should allow having duplicate Display names, but not duplicate Internal names... and in my case I want to rename my site column to be Owner.. but since I have another column with this name I got the error.. but still the 2 columns have different internal names.. so I am not sure what I can do ? now one way I find to fix this temporary is to rename the column at the list level from IT Department Owner to Owner.. where I did not get any error message.. but still I want this renaming to be done at the site level... so can anyone adivce on the above problem please?

3

Because you have to use unique DisplayNames for Calculated Column Formulas
(and internal Computed Columns you don't see those in the UI)

So there is a check for Duplicate names in a lot of (UI) code

You can change DisplayNames with code.. CSOM, JSOM, REST, whatever you prefer:

My (private) CalcMaster tool does it (Column3 renamed to Column1) for Calculated Columns,
it works for all Custom Columns

But I strongly advice not to do it, because any Update through the UI will no longer work .. so you have to do everything with code


Proof it can be done:

[Column1] = "One"

[Column2] = [Column1] It uses the first Column1

[Column1] (Column3) ="Three"

  • now usually when i want to have multiple columns with the same display names i use power-shell script which allow me to define unique static and internal names, but i can have define duplicate display names... and i can later on change the columns display names using the UI.. but in my above case the columns were created from the UI from the beginning.. so i am not sure if i got your point correctly ? i should not have duplicate display names even if i can do so using powers-hell or other techniques ?? can provide more details? – john Gu May 8 '17 at 14:17
  • No more details, I advice not to do this, as it cost me loads of time. Feel free to do with code whatever you want to do. But be aware the next SharePoint consultant will have no clue why his additions/changes do not work. – Danny '365CSI' Engelman May 8 '17 at 14:21
  • Also if you create new site collection, you can see that sharepoint will provide many built-in site columns which have the same display names... for example there are 2 columns which have "Translation Status" as the display name also i can see 2 columns with "Translator Name" as their display names... so if SP do this .. then i think i can also do this ... – john Gu May 8 '17 at 14:22
  • also i am not doing so for no reason.. now i have this scenario as an example,, where we have 5 department sites, and each site have a column named Owner.. but for each dept site the owner is linked to different group.. and our customer asked us that he want to have the same title for all the Owners ,, – john Gu May 8 '17 at 14:27
  • but each owner should be linked to different group.. so in this case i have to create 5 site columns with Owner as the display name... but differ in their internal names which will be "ITOwner","HROwner" , etc.. so the customer requirement which will lead you to these scenarios .. also i always try to group my columns inside groups .. so you will find duplicate display names for the columns but not under the same site group.. – john Gu May 8 '17 at 14:27
2

Use below PowerShell script and try to search the name in "Title" (Display Name) field. If the name exists there, then you can't use that name.

Add-PsSnapin Microsoft.SharePoint.PowerShell 
## SharePoint DLL++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Start 
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")  

# Give Your Site Collection URL 

$url= "http://demoSite" 

# Code to Get the current working directory and generate the file Name with Current Date and Time + SiteColumnDetails.CSV 
function Get-ScriptDirectory 
{ 
    $Invocation = (Get-Variable MyInvocation -Scope 1).Value 
    Split-Path $Invocation.MyCommand.Path 
}  
$localFolderObject = Get-ScriptDirectory 
$localFolder = $localFolderObject.ToString() + "\" 
#Get current working directory 
$today = Get-Date 
$fileName = $localFolder + $today.Day.ToString() + "-" + $today.month.ToString() + "-" + $today.year.ToString() + "--SiteColumnDetails.csv" 


#Writing the CSV Column Header  - Tab Separated 
 "Column Title `t Site Column ID `t InternalName `t StaticName `t MaxLength `t Description `t Group `t TypeShortDescription " | out-file $fileName 


#Operation+++++++++++++++++++++++++++++++++++++++++++++++++++Start 
$site   =    new-object Microsoft.SharePoint.SPSite($url) 
$web    = $site.rootweb.Fields 
echo "Generating File..." 
ForEach ($id in $web) 
{ 

"$($id.Title) `t $($id.Id) `t $($id.InternalName) `t $($id.StaticName) `t $($id.MaxLength)/$($id.MaxLength) `t $($id.Description) `t $($id.Group) `t $($id.TypeShortDescription) " | Out-File $fileName -Append 

} 
$site.Dispose() 

#Operation+++++++++++++++++++++++++++++++++++++++++++++++++++Start 
echo "CSV file generated successfully, please check the below given path" 
echo "File created at : + $fileName "
  • i mentioned from the beginning that i already have a column named "Owner" .. but i should be able to have duplicate display names for my site columns as long as they have unique internal names... – john Gu May 8 '17 at 14:19
  • Yeah just run the script it will return you the name of the site columns with its title and group. If you found your "Owner" column as a display name of a column of a particular group then you can't use "Owner" as a display name. – Divya Sharma May 8 '17 at 16:37
  • i did not get your point correctly .. what do you mean by "of a particular group " which group you are referring to ??? and again why if i find a column with a display name = Owner,, then i can not define another column with this name ,, as i mentioned before sharepoint should allow me to have duplicate display names is this correct ? or i am missing something ? – john Gu May 9 '17 at 0:36
  • Site columns, which are created, are displayed under particular group about which I am talking. In SharePoint, some names are reserved which we can't use. – Divya Sharma May 9 '17 at 7:29
0

Enter New name and run this in the browser console

function ValidateAndSubmit() {  
       return true; 
    }
    function doesFieldNameConflict(strName) {
        return false; 
    }

You will be now able to save the name.

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.