22

Using the SharePoint 2013 REST API,

Can I get more than one column from the lookup column by using the $select and $expand endpoints?

17

Yes, you can expand multiple columns:

/_api/web/lists(guid'<guid>')/items?$select=Title,LookupField1/FieldToBeExpanded1,LookupField2/FieldToBeExpanded2&$expand=LookupField1,LookupField2
4

below query finally worked for me

  • Merged is a calculated field in Cats list
  • Cat is a lookup field(which looks above Merged column) in the MainFlat list

            "?$select=Title,number,Cat/Merged&$expand=Cat" + 
            "&$filter=Cat/Merged eq '"+Merged+"'  "
    
  • i have problems @imanabidi that solved by your answers thanks ;) – saber tabatabaee yazdi Jan 1 '17 at 6:34
2

Consider your lookup column name as "Field1LUP" of "List1" and "Title" field of "List2" is source to lookup field.

/_api/web/lists(guid'<guid>')/items?$select=Field1LUP/Title&$expand=Field1LUP
-2

The REST API and OData request parameters can be used to request additional information from a lookup field. As an example, An Employee list with a Department lookup field. If we need to get the employee name and id as well as the department name and id, we can use this GET request:

_api/web/lists/getbytitle('employee')/items?$select=Department/Name,DepartmentId,Name,Id&$expand=Department

This gets the employee( DepartmentId, Name, and Id). We expand the Department look up field and read the department name (Department/Name). The requirement is to expand the lookup list and prefix every field with the list name.

More information can be found at:

http://www.ozkary.com/2015/10/sharepoint-2013-api-odata-for-lookup-fields.html

hope it helps.

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.