I have an SPFx customization that uses the SharePoint REST API to query a list and expand and select properties of one of its child lists. The request looks something like this:
https://mine.sharepoint.com/sites/MySite/_api/web/lists/getByTitle('Parent')/items?$expand=Child&$select=Child/Property
I'm able to get the child's ID
and Title
properties but when I try to select another of type bool (IsEnabled
) it causes the query to become invalid.
{
"odata.error": {
"code": "-1, Microsoft.SharePoint.SPException",
"message": {
"lang": "en-US",
"value": "The query to field 'Child/IsEnabled' is not valid."
}
}
}
How can I craft a query to the parent list that can select the child's properties that aren't used to make the reference? I'm sure I can do it by iterating the parent's list items and making separate queries against the child list by ID
but that's messy and inefficient; is there another way?