Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, August 6, 2012 5:43 PM
Hello all,
Has anyone run across a script to change the internal name of a site column. I have several created at the site collection level and change some of the internal names (ex. Internal name of "DocumentType" to "DocumentTypes". I can change the Display Name all day through the GUI but need to clean things up for development purposes.
Thanks!
Kelly
Personal Blog: http://thebitsthatbyte.com
All replies (9)
Tuesday, August 7, 2012 8:46 AM
Hard question.
Just an ideaa for a script:
-- Get the website
$web = Get-SPWeb http://url
-- Get the list name
$list = $web.Lists["ListName"]
-- Get the list Display name
$field = $list.Fields["Name"]
-- Display the internal name
Write-Host $field.InternalName
-- Display XML Schema of the field
$field.SchemaXml
-- Replace something from schema
--v1.
$field.SchemaXml=$field.SchemaXml.Replace(“Name=`”oldName`”",”Name=`”newName`”")
--v2.
$field.SchemaXml.Replace($field.InternalName, "newInternalName")
--v3.
$field.SchemaXml = $field.SchemaXml.Replace($field.InternalName, "newInternalName")
$field.pushChangesToLists = $true
$field.update($true)
But I do not understand why changes are not saved...
Just try.
Something similar to your problem: http://social.technet.microsoft.com/Forums/en-AU/sharepoint2010programming/thread/879156f7-1297-40f0-9208-ba389a68998f
Please give us a replay if it works for you.
http://valygreavu.wordpress.com/
Tuesday, August 7, 2012 8:57 AM | 1 vote
Finally I think that you cannot change the InternalName of a column. You can try to use: SharePoint Manager 2010 http://spm.codeplex.com/releases/view/51438 to check that some columns properties are read-only.
You can edit directly the schema using SP Manager but nothing happens when you are changing the Name...
http://valygreavu.wordpress.com/
Tuesday, August 7, 2012 10:07 AM
Another similar thread and possible solution: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/9700fb86-d3a2-4597-aa83-1e3f8973275f/
http://valygreavu.wordpress.com/
Tuesday, August 7, 2012 10:12 AM | 1 vote
But finally I got the message: "InternalName" is a ReadOnly property.
You cannot change the internal name of a Column.
http://valygreavu.wordpress.com/
Tuesday, August 7, 2012 1:43 PM
Thanks Valy, can anyone from Microsoft confirm that internal column names cannot be changed?
Personal Blog: http://thebitsthatbyte.com
Tuesday, August 7, 2012 1:59 PM | 1 vote
Kelly until they will confirm or not, can you try also this: http://stackoverflow.com/questions/3784023/updating-the-internal-name-using-the-content-database
http://valygreavu.wordpress.com/
Tuesday, August 7, 2012 2:09 PM | 1 vote
Thanks Valy, it looks like the methods are not recommended/scary. There is a tool that could be used for this purpose: http://splistitemeditor.codeplex.com/
Personal Blog: http://thebitsthatbyte.com
Tuesday, August 7, 2012 2:15 PM | 1 vote
Kely I was trying to modify directly into the database... on my test server... but nothing... :) The Internal name is storet into Resources table into the web app content database... but I'm not sure about the other refferences into the database... Maybe someone from Microsoft can confirm the read-only of the Internal Name. I'm trying right now the procedure specified into the previous link.
The codeplex tool do not works for me! :(
http://valygreavu.wordpress.com/
Tuesday, August 7, 2012 6:58 PM
Thanks Valy. I guess we wait and see!
Personal Blog: http://thebitsthatbyte.com