Skip to main content
changed question to accomadate a follow up question
Source Link
wjervis
  • 5.7k
  • 25
  • 45

You use the $expand query option. For

For example, a list has a lookup field,you have two lists: LookupFieldListA, and in that list areListB. ListA has two fields you want to pull with the query,: Field1 and Field2. ListB has three fields: FieldA, FieldB and LookupField. LookupField looks up to ListA. REST query should be as such:

/_api/web/lists/GetByTitle(guid'<guid>''ListB')/items?$select=Title$select=FieldA,FieldB,LookupField/Field1,LookupField/Field2&$expand=LookupField

You select the fields from the list by adding their internal name to the $select query option, and you select fields from the lookup list by using the format LookupField/FieldFromLookupList, and then you add the lookup field to the $expand query option.

You use the $expand query option. For example, a list has a lookup field, LookupField, and in that list are two fields you want to pull with the query, Field1 and Field2. REST query should be as such:

/_api/web/lists(guid'<guid>')/items?$select=Title,LookupField/Field1,LookupField/Field2&$expand=LookupField

You use the $expand query option.

For example, you have two lists: ListA and ListB. ListA has two fields: Field1 and Field2. ListB has three fields: FieldA, FieldB and LookupField. LookupField looks up to ListA. REST query should be as such:

/_api/web/lists/GetByTitle('ListB')/items?$select=FieldA,FieldB,LookupField/Field1,LookupField/Field2&$expand=LookupField

You select the fields from the list by adding their internal name to the $select query option, and you select fields from the lookup list by using the format LookupField/FieldFromLookupList, and then you add the lookup field to the $expand query option.

Source Link
wjervis
  • 5.7k
  • 25
  • 45

You use the $expand query option. For example, a list has a lookup field, LookupField, and in that list are two fields you want to pull with the query, Field1 and Field2. REST query should be as such:

/_api/web/lists(guid'<guid>')/items?$select=Title,LookupField/Field1,LookupField/Field2&$expand=LookupField