How to Get Lookup column using lookup column using REST API
-
20-10-2020 - |
Domanda
I have one summery custom list in which I have lookup column of detail list.
So I am retrieve all data from it using expand it. But in detail list I also have one lookup column of personal Detail list.
Now how can I get personal Detail from lookup of summery list.
Any help will highly appreciated.
Soluzione
You can not $expand
any lookup column of child list. You can only $expand
all lookup column of parent list. Let say, you are querying on A list and A has a lookup column from B list. B has a lookup column from C list. So if you are querying on A list, then you can only $expand
all columns of B.
/_api/web/lists/getbytitle('A')
You can not $expand
any column from C. The reason is there is no direct relation between A and C.
Workaround
At first get the item Id
of B list, then make another REST call to B and $expand the columns of C
/_api/web/lists/getbytitle('B')/items({ItemId})?$select={select column from c}&$expand=C
You can use SharePoint REST Client to test your query.
Update
You can make a batch request as you have many items from B.