SharePoint 2010 Rest query for Lookup fields

I am writing a REST query to retrieve data from child parent list.

States is the parent list with "Title" column.
LocalGovernment is the child list with "State_Territory(InternalName) and State / Territory(Display name)" as a lookup column.

Following is the output without any filter



I am trying to get "title" of the state from the parent list.

Query  = /_vti_bin/listdata.svc/LocalGovernmentAreas?$select=State_Territory/Id&$expand=State_Territory/Id

Type 'Microsoft.SharePoint.DataService.LocalGovernmentAreasItem' does not have a property named 'State_Territory' - I am using "State_Territory" because it is the internal name.

I have also tried 

/_vti_bin/listdata.svc/LocalGovernmentAreas?$select=StateTerritory/Id&$expand=StateTerritory/Id

but error is 

Only properties specified in $expand can be traversed in $select query options. Property 


May 18th, 2015 6:44am

Hi,

According to your description, my understanding is that you want to get the source list "Title" property of a look up field using SharePoint 2010 rest service.

In my environment, I create a list named "List1" and then create a text field named "Source". Then I create a list named "List2" and a lookup field named "testlookup" to the "source" field in list1.

Then I used the rest query url below to get the Parent list item Title:

http://sp1gm/sites/test/_vti_bin/listdata.svc/List2?$select=Testlookup/Id,Testlookup/Title&$expand=Testlookup

Here is a detailed thread for your reference:

How to get lookup value only via REST (listdata.svc)

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
June 5th, 2015 1:59am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics