0

It's a common case that you use lookups in your list.

When using ODATA, Is it possible to include the actual value of the lookup instead of the (other) SharePoint list item ID?

1 Answer 1

0

You can expand the lookup column.

https://***/sites/_vti_bin/ListData.svc/List?$select=Title,LookupColumn/OtherColumn&$expand=LookupColumn

In this example my list has a column called LookupColumn that looks up a value in another list. This other list has a column called OtherColumn. By expanding LookupColumn in your query you can access the value of OtherColumn.

Reference:

Use OData query operations in SharePoint REST requests

7
  • does this work for SharePoint 2010? I always get a HTTP 400, so a bad request... Jul 25, 2016 at 7:03
  • Yes, it should work. Maybe you can provide a bit more information, list schemas, the query you are using, etc.. Maybe we can figure out what's wrong. Jul 25, 2016 at 7:06
  • sure, sorry: http://***/sites/_vti_bin/ListData.svc/ProjectStatusReports?$select=*,ProjectId/Project%20ID&$expand=ProjectId Jul 25, 2016 at 7:36
  • Try it without %20. Spaces are automatically stripped from the column name when you query their data via ListData.svc. 'http://***/sites/_vti_bin/ListData.svc/ProjectStatusReports?$select=*,ProjectId/Pr‌​ojectID&$expand=ProjectId' Jul 25, 2016 at 8:08
  • If I can't see what the lookup column is (through the SP list settings interface) is it somehow possible to figure out with the help of the REST API? I just got told that the list view is created through a workflow. When I look at the xml I only see ProjectId (and some other columns) but in the view itself I see many other identifers like Project Name and ProjectID & Project:ID which I don't just don't see in the ODATA Query result Jul 25, 2016 at 12:28

Your Answer

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

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