1

I have created a site column of type "People or Group" and i name it "Software Development Risk/Issue Owner". now i added this site column inside multiple lists. now i find this confusing issue.

when i access the site column from the site level i inspected the following Internal name Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner from the URL :-

/_layouts/15/ManageContentTypeField.aspx?ctype=0x0103004AFB52A22B74934CB139F46F5A802B7505&Field=Software%5Fx0020%5FDevelopment%5Fx0020%5FRisk%5Fx002F%5FIssue%5Fx0020%5FOwner&Fid=

while when i access the site column from one of the list levels, i inspected the following Internal name Software_x0020_Development_x0020 from the URL :-

/_layouts/15/FldEditEx.aspx?CloseOnCancel=1&List={60F9B143-EBA4-47C6-B714-3AA863B26AAC}&Field=Software%5Fx0020%5FDevelopment%5Fx0020&Source=

so my First question is why the site column have 2 different internal names ; one at the site level while the other at the list level ?

Second question, now i wanted to move some items from one list named "Action" to another list named "Risk Issue" , using the following power-shell script :-

$web = get-spweb "http://*****/teamsites/SoftwareDevelopment/"
$list = $web.lists["Action"]
$list2 = $web.lists["Risk Issue"]
foreach ($i in $list.items)
{
$a = $i["ID"];
$sourceItem = $list.items.GetItemById($a)

$versions = $sourceItem.versions;

$newItem = $list2.items.Add();

$versionCount = $versions.Count;

##We need a for loop here as we must work backwards through the version collection
for ($i = $versionCount;$i -gt 0;$i--)
{
    $version = $versions[$i-1];


    $newItem["Title"] = $version["Title"];
    ##code goes here.....
    $newItem["Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner"] = $version["Software_x0020_Development_Manager"];


    $newItem.Update();

}
}

but i got this exception :-

Column 'Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner' does not exist. It may have been deleted by another user. At line:21 char:5 + $newItem["Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner"] = ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo : OperationStopped: (:) [], ArgumentException + FullyQualifiedErrorId : System.ArgumentException

now if i replace this $newItem["Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner"] with this $newItem["Software_x0020_Development_x0020"] (in other words i used the list level internal name instead of the site level internal name ) the exception will disappear .. so what is causing this? i always reference the site columns as defined inside the site level,, not sure why in this case i can not do so ?

can anyone adivce on this please ?

-----------EDIT-------

For my second question i did the following test . Here my test for 3 columns:-

1) First Column have its internal name at the list level = "DueDate", while at the site level its internal name = "TaskDueDate".

2) Second Column have its internal name at the list level = "Technical_x0020_Delivery_x0020_T", while at the site level its internal name = "Technical_x0020_Delivery_x0020_Team".

3) Third Column have its internal name at the list level = Software_x0020_Development_x0020, while at the site level its internal name = Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner.

now on the first and third site columns i was NOT able to reference the columns using their site level internal names as shown below, as i will get an error inside the powershell windows that it can not find these columns

$newItem["TaskDueDate"]

&

$newItem["Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner"]

and i have to use their internal names as defined inside the list level (not site level), so this will not raise an error:-

$newItem["DueDate"]

&

$newItem["Software_x0020_Development_x0020"]

while for the second column i was able to reference it either using its site level or list level internal names.. so can anyone adivce what is the rule that govern this ?

  • 3
    As an aside - many people follow a certain practice in naming columns that takes advantage of the fact that once a column internal name is set, it does not change. So when creating columns through the UI, they would initially name it something like "SoftwareDevelopmentRiskOwner", and then go back and edit the name to be "Software Development Risk/Issue Owner". The display name will be changed, but the internal name will remain "SoftwareDevelopmentRiskOwner". In that way, you can plan and manage your internal names. – Dylan Cristy Dec 1 '15 at 19:44
  • What @DylanCristy said!! Look at the mess. Use only letters and numbers when creating columns and life will be so much easier. – teylyn Dec 1 '15 at 21:10
  • @teylyn now the column is already created and SharePoint did not raise any error when i create them and later on when i edit the display name. also I do not have any problem in finding the internal name which is "Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner",, so regardless that the internal name is somehow long , but it is set like this .. but my question is why my powershell script raise the error , although i am using the correct internal name? while if i use the internal name which is set at the list level (not site level) the script will work !!! this is my question – john Gu Dec 1 '15 at 23:55
  • @DylanCristy i know that create/editing the site columns using the UI will not affect the internal name, but i have a list which i document all the internal names for the site columns, but my question is why my powershell script raised an error when i use the internal name of my site column as defined inside the site level,,, while when i use the internal name of my column as defined inside the list level the script worked well ... so could my site column name which is "Software_x0020_Development_x0020_Risk_x002F_Issue_x0020_Owner" is causing the problem ?? – john Gu Dec 1 '15 at 23:57
  • 1
    Yes, I agree with you, that last one is a bit confusing, seems like it shouldn't have worked. I'm not sure what's going on there, so I can't help with that one, sorry. – Dylan Cristy Dec 2 '15 at 14:06
3

Very long column names are truncated to 32 characters at the list level. That even happens when you create a column in the list that is not based on an existing site column.

Try it. Create a column with a name that has more than 32 characters, for example aaaaabbbbbcccccdddddeeeeefffffggggghhhhh. Then edit the column and look at the URL. Only the first 32 characters show up.

http://sharepoint/_layouts/FldEdit.aspx?List=%7B7E1CF10A%2D52C2%2D4D85%2DBFD5%2D7DA851FE248D%7D&Field=aaaaabbbbbcccccdddddeeeeefffffgg

Software_x0020_Development_x0020 has exactly 32 characters. The rest of the column name is truncated.

Spaces and other special characters like dashes, underscores, slash etc, further muddy the waters with the %20 etc.

So, the answer is: keep the column names shorter than 32 characters.

  • ok i will keep this in mind to keep site column short,, but currently i already have the site column created ,, also on my site level the url looks as follow :- /_layouts/15/ManageContentTypeField.aspx?ctype=0x0103004AFB52A22B74934CB139F46F5A802B7505&Field=Software%5Fx0020%5FDevelopment%5Fx0020%5FRisk%5Fx002F%5FIssue%5Fx0020%5FOwner&Fid= ///// which means it was not truncated,,, so are you saying that the name will only be truncated on the list level , and not on the site level ? – john Gu Dec 2 '15 at 0:42
  • 1
    That's what I wrote. Just read my post. First sentence, last three words. – teylyn Dec 2 '15 at 0:56
  • ok i got your point so the column internal names will be truncated at the list level only,, this answers my first question ,, thanks, but can you please adivce on my second question ? i edited my original question and i provide more details about it ,, thanks – john Gu Dec 2 '15 at 1:20
2

Using a site column in a list effectively makes a copy of the site column and turns it into a list column. You can then make changes to the column within the list. For example, if your site column is a Choice field, and your choices are A and B, in the list you can change the choices in the column to be A, B, and C without affecting the site column. You can then change the site column and indicate whether you want those changes to propagate to the inheriting column in your list.

The internal column name in your case was truncated because the name of your site column is so long.

  • ok thanks for the reply ,, i already know this info about creating a copy of the site column at the list level,, but my question is why i got the exception (when i run the powershell script) when i used the Internal name of my column as defined inside the site level ? while the script worked well if i use the column internal as defined on the list level ?? – john Gu Dec 1 '15 at 19:43
  • 2
    Because your powershell operates on the list, and is thus looking for the list column internal name... it doesn't care that the list column is inherited from the site level. – Erin L Dec 1 '15 at 19:47
  • so can u be more specific in your answer please ,, you mean that i should use the internal names of the site columns as they are defined inside the list level and not as they are defined inside the site level ? but on other cases i am using the internal names of the site columns as defined inside the site level and the scripts worked well, although for these sites columns their internal names on the list level are different from their internal names on the site level ... – john Gu Dec 2 '15 at 0:02
  • for example i have a site column that have its internal name as "Technical_x0020_Delivery_x0020_Team" on the site level, while its internal name at the list level is "Technical_x0020_Delivery_x0020_T" , but on my script i was able to reference it suing its internal name as defined on the site level which as follow $newItem["Technical_x0020_Delivery_x0020_Team"] – john Gu Dec 2 '15 at 0:33
  • can you please check my edit section regarding my second question , thanks – john Gu Dec 2 '15 at 1:36

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.