0

I have a list that has a look-up column into another list. Ex: B list has a look-up column called 'navB' that is a look-up into a column in list A. The name of that column in list A is called 'navA'.

When I look at the api, I see an ID called 'navBId'.

I try to expand it like this but it doesn't work

/_api/web/lists/getbyTitle('B')/items?$select=navBId&expand=navA

I get an error when I do this.

What am I doing wrong? Thanks

2

If "navB" is the column that is in list B but is a lookup to list A, you want something like this:

/_api/web/lists/getbytitle('B')/items?$select=navB/Title,navB/Id,navB/OtherColumn&$expand=navB

You want to select which fields from the lookup list that you want returned, then expand the lookup column in this list.

If you want the value of the "navA" column from the other list, it would be

/_api/web/lists/getbytitle('B')/items?$select=navB/navA&$expand=navB
  • Excellent! Thank you sir – OLA yesterday
1

As @Dylan said, when using $expand endpoint you need to mention the column name from List B in $expand and then you can select the column from List A in $select query like below:

siteUrl/_api/web/lists/getbytitle('B')/items?$select=navB/navA,navB/Title,navB/Id&$expand=navB

Adding to this answer,

You cannot expand and select all the columns from List A as lookup columns does not support all the column types.

Supported Column Types:

  • Single line of text
  • Choice (single value)
  • Number
  • Currency
  • Date and Time
  • Lookup (single value)
  • Person or Group (single value)

Unsupported Column Types:

  • Multiple lines of text
  • Choice (multi-valued)
  • Calculated
  • Hyperlink or Picture
  • Custom Columns
  • Lookup (multi-valued)
  • Person or Group (multi-valued)
  • Yes/No

Source:

  1. Create list relationships by using unique and lookup columns - Check Creating unique columns section.

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.