You can make a request to the REST API and request metadata regarding the fields in the list.
For example, sending a GET request to the URL https://sharepoint.domain.com/_api/lists/getbytitle('Test List')?$select=Fields&$expand=Fields
will return an array with all the metadata for the fields. Here is an example of one of the objects in the array:
{
"__metadata": {
"id": "https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Fields(guid'e8f4448b-9204-488b-9857-878dc793637a')",
"uri": "https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Fields(guid'e8f4448b-9204-488b-9857-878dc793637a')",
"type": "SP.FieldChoice"
},
"DescriptionResource": {
"__deferred": {
"uri": "https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Fields(guid'e8f4448b-9204-488b-9857-878dc793637a')/DescriptionResource"
}
},
"TitleResource": {
"__deferred": {
"uri": "https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Fields(guid'e8f4448b-9204-488b-9857-878dc793637a')/TitleResource"
}
},
"CanBeDeleted": true,
"DefaultValue": null,
"Description": "",
"Direction": "none",
"EnforceUniqueValues": false,
"EntityPropertyName": "Test_x0020_Item",
"Filterable": true,
"FromBaseType": false,
"Group": "Custom Columns",
"Hidden": false,
"Id": "e8f4448b-9204-488b-9857-878dc793637a",
"Indexed": false,
"InternalName": "Test_x0020_Item",
"JSLink": "clienttemplates.js",
"ReadOnlyField": false,
"Required": false,
"SchemaXml": "<Field Type=\"Choice\" DisplayName=\"Test Item\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" Format=\"Dropdown\" FillInChoice=\"FALSE\" ID=\"{e8f4448b-9204-488b-9857-878dc793637a}\" SourceID=\"{efd16a43-aaf4-44fd-a9a1-4634afe328ac}\" StaticName=\"Test_x0020_Item\" Name=\"Test_x0020_Item\" ColName=\"nvarchar3\" RowOrdinal=\"0\" Version=\"1\"><CHOICES><CHOICE>Enter Choice #1</CHOICE><CHOICE>Enter Choice #2</CHOICE><CHOICE>Enter Choice #3</CHOICE></CHOICES></Field>",
"Scope": "/Lists/Test List",
"Sealed": false,
"Sortable": true,
"StaticName": "Test_x0020_Item",
"Title": "Test Item",
"FieldTypeKind": 6,
"TypeAsString": "Choice",
"TypeDisplayName": "Choice",
"TypeShortDescription": "Choice (menu to choose from)",
"ValidationFormula": null,
"ValidationMessage": null,
"FillInChoice": false,
"Mappings": null,
"Choices": {
"results": [
"Enter Choice #1",
"Enter Choice #2",
"Enter Choice #3"
]
},
"EditFormat": 0
}
If you used this query string, though, ?$select=Fields/Title,Fields/InternalName&$expand=Fields/Title,Fields/InternalName
it would only return the the Title
(label) and InternalName
along with the associated __metadata
object..
{
"__metadata":{
"id":"https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Fields(guid'e8f4448b-9204-488b-9857-878dc793637a')",
"uri":"https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Fields(guid'e8f4448b-9204-488b-9857-878dc793637a')",
"type":"SP.FieldChoice"
},
"InternalName":"Test_x0020_Item",
"Title":"Test Item"
}
Once you have that data you should be able to display the correct label in your UI.