4

I have a column called "myColumn". When working with that column in SharePoint REST services I must use "MyColumn" instead (note the capitalized leading 'M'). Likewise, if my column name has spaces, then I must ensure the first letter of every word is capitalized and spaces removed: for example, "my column" becomes "MyColumn".

Further, when one or more columns' "transformed" name conflicts with an existing one, then the transformed names get a numeral appended. So, in a list with columns named "myColumn" and "my column" the names by which they are referenced via REST would be "MyColumn" and "MyColumn0", respectively.

I believe the same rules apply for list names.

Is there definitive documentation on what rules are applied for capitalization?

EDIT: I am using SharePoint 2010

2 Answers 2

3

Both field names and List names in SharePoint 2010 RESTare case sensitive. Internal names of fields don't work. What works for fields is that you have to preserve casing and remove any spaces in the display name. For example if the dispaly name of the field is "company Employees", then the field name in REST will be "companyEmployees". Similary for Lists you have to preserve casing and remove any space in the list title. List Urls don't work. I have documented these observations here: http://sharepointnadeem.blogspot.in/2012/01/sharepoint-2010-rest-api.html http://sharepointnadeem.blogspot.in/2012/06/field-names-in-rest-query-are-case.html

EDIT One more thing if you have a special character e.g dot in field name or List name it is to be treated like space i.e. if field name is "Add.ress" the REST equivalent will be "AddRess"

4
  • Your answer is mostly correct, however, in your example the correct field name would be "CompanyEmployees".
    – Chloraphil
    Commented Aug 8, 2013 at 13:16
  • You are correct the correct field name will be "CompanyEmployees". So, in order for the fields to work in REST, we need to preserve casing, remove spaces and keep the first letter of each individual word as Capital. For example a field with display name "home aDdress" will be "HomeADdress" in REST Commented Aug 8, 2013 at 14:40
  • just wondering what if there is "MyList" list and I add new one named "my list". How capitalization rules will then work?
    – andrii
    Commented Apr 22, 2015 at 12:57
  • Does anybody know why MS decided to use yet ANOTHER SET of field names (internal, static, display, now a fourth for REST)? The REST API appears to take the displayname and strip out the spaces. From a programming standpoint, I can't rely on those field names remaining the same. Isn't the primary purpose of the REST services to build applications around it? For robustness, using the field's internal name is a must -- anyone know?
    – Eccentropy
    Commented Dec 17, 2015 at 16:22
-1

In my experience, this is not an issue of capitalization or casing. Each column in SharePoint has an internal name and a display name. Once a column is created, only it's display name can be changed. Not it's internal name.

I believe only the exact internal name (with the same case) of the column should be specified in the REST query.

If the internal name of your column is "MyColumn" and the display name is "myColumn", then the REST query will only accept "MyColumn".

I just tested this in my environment. Check the internal names of your columns and re-confirm. Here is how to find the internal name of a column (Link is for 2010 but it should work for 2013 too):

http://techtrainingnotes.blogspot.in/2012/10/sharepointfinding-column-display-and.html

5
  • In an internal name the spaces are replaced by "_x0020_". Using the internal name fails in this case.
    – Chloraphil
    Commented Aug 7, 2013 at 19:24
  • spsiteurl/_api/web/lists/getByTitle('AdminContacts')/items?$select=Company_x0020_name This query works for me. Commented Aug 7, 2013 at 19:38
  • Can you update your query in the question? Commented Aug 7, 2013 at 19:43
  • I am using SharePoint 2010. Perhaps that explains the differences?
    – Chloraphil
    Commented Aug 7, 2013 at 20:25
  • 1
    SharePoint 2010 field names operate under different rules. This info is incorrect for working with ListData.svc. Commented Feb 18, 2014 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.