2

I am facing an issue while attempting to retrieve data from a SharePoint list using the REST API. The list contains a single line of text column named "DisplayName". However, when making a REST API call to fetch items, the response does not include the DisplayName column.

Attempted Solution: I have tried to include a select query for the DisplayName column in the API call, as shown below:

_api/web/lists/getByTitle('SharepointList')/items(14)?$select=ID,DisplayName

However, this results in an error with the message:

'Value does not fall within the expected range.'

A screenshot illustrating the error is attached for reference:

enter image description here

Query:

  1. Can someone please explain why this error is occurring?
  2. Is there a specific approach or modification to the API call that needs to be made to successfully fetch data from the DisplayName column?
  3. Are there any additional considerations or configurations that might be causing this issue?

Any guidance or assistance in resolving this problem would be greatly appreciated.

Thank you in advance.

2
  • How many total items are in the list? Was this created a text column from start or was it column with other data type and then changed to text column? Mar 1 at 7:17
  • total 300 items in the list. Column was single line of text only from the begining. Mar 1 at 7:32

1 Answer 1

2

It seems that "DisplayName" word is not working as the list column internal name with the normal select query of the REST API.

You can try FieldValuesAsText method to retrieve all columns data in string for the list item and in that you will get this column data as well.

enter image description here

/_api/web/lists/getByTitle('SharepointList')/items(1)/FieldValuesAsText

OR you can create the new column with different name and remove this column.

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.