8

On-site enterprise install of SP 2013.

I have a list called Questions. This list has a Title, ID, and a custom field called "Question" that is a Multiple Line of Text field set to type: Plain Text.

I've created a second list called LPA_Questions that contains a Lookup to my Questions list. So far so good. Although I should note that I notice when setting up this custom column, the Question column is not one of my choices to display - I'm only offered Id, Title, Modified, Created Version.

So, I'm trying to execute a _api/web query on the LPA_Questions list and expand the Question field.

This works:

    _api/web/lists/getbytitle('LPA_Questions')/items?$filter=&$top=0&$select=Id,Question/Id&$expand=Question

This does not:

 _api/web/lists/getbytitle('LPA_Questions')/items?$filter=&$top=0&$select=Id,Question/Id,Question/Question&$expand=Question

Error:

The query to field 'Question/Question' is not valid.

Am I missing something obvious here?

4
  • Just for fun I tried this: _vti_bin/listdata.svc/LPA_Questions?$select=Question/Id,Question/Title,Question/Question&$expand=Question The listdata.svc had no problems. Is there a difference in the way the _api/web handles things and listdata.svc?
    – skrile
    Aug 14 '14 at 12:06
  • I too am having this issue. Did you ever fix it? Jan 8 '15 at 21:44
  • dinushaonline.blogspot.in/2014/09/…
    – user13408
    Nov 2 '15 at 17:37
  • The problem is that $expand only supports a limited set of column types. This other answer says that you can only select/expand columns that are single line of text, date/time, or number. I don't have a good way to work around this, other than to select the linked Question by ID using a second call.
    – Coderer
    Aug 10 '20 at 14:52
1

Try using the query string (my caps may be off) &$select=FieldValuesAsText,FieldValuesAsHtml&$expand=FieldValuesAsText,FieldValuesAsHtml

This should allow for those fields to be returned inside of the FieldValuesAsText key/node

2
  • Nope. Your example isn't referencing a lookup field. _api/web/lists/getbytitle('Project_Team')/items?$select=Project/Description&$expand=Project This example expands Project (the lookup field) and tries to retrieve the Project/Description field which is a Rich Text field. Sharepoint responds with "The query to field 'Project/Description' is not valid."
    – skrile
    Aug 9 '16 at 13:27
  • I tried as you said, however, expading the select items query to also FieldValuesAsHtml etc... only returns the URI for that column, not the rest of the data :(
    – Alberto S.
    Aug 24 '18 at 10:46

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.