Mar 13 2023 08:20 PM
I have a list with a few columns that are Person columns. Below is a snippet without a select nor expand:
const newHires = this._sp.web.lists.getById(${listId}).items<ListItem[]>();
const resolvedTasks = Promise.resolve(newHires);
Two of my Person fields are called Manager and Dude. As you'll see from the screenshot, I only get DudeId and DudeStringId (ditto for Manager field). When I try the following:
const newHires = this._sp.web.lists.getById(`${listId}`).items.select("Manager/Email").expand("Manager")<ListItem[]>();
I get the following 400 error: "odata.error":{"code":"-1, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"The query to field 'Manager' is not valid. The $select query string must specify the target fields and the $expand query string must contains Manager."
I've also checked in the library settings that the field name is indeed Manager.
Mar 13 2023 11:36 PM
Hi @Jono_Suave,
the selected properties are case-sensitive. Try
.select("Manager/EMail").expand("Manager")
Best Regards,
Sven