I have a REST query that looks like this
/_api/lists/getbytitle('MainList')/items?$select=Title,LookupField/Id,LookupField/Title&$expand=LookupField
That works fine. But when I try to pull another field from the lookup list, I get an error. This query:
/_api/lists/getbytitle('MainList')/items?$select=Title,LookupField/Id,LookupField/Title,LookupField/CustomField&$expand=LookupField
Results in:
The query to field 'LookupField/CustomField' is not valid.
I should point out that if I try to pull in a standard field such as LookupField/Modified
or LookupField/Created
it works fine. It's only when I try to select a custom field that I get this error. Is that a limitation of the SharePoint API?