1

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.

1 Answer 1

1

Try using endpoint like:

const newHires = this._sp.web.lists.getById(`${listId}`).items.select("Manager/EMail").expand("Manager")<ListItem[]>();

Use EMail instead of Email.

2
  • 1
    Thank you that did the trick.
    – Jono Suave
    Commented Mar 14, 2023 at 14:14
  • Great, glad it worked for you! Commented Mar 14, 2023 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.