I am working with SharePoint on-premise 2019 and I am trying to get job title from multiple users that are stored in a list as an object.
I am using pnp-sp-js and React framework and can successfully get users ID from a list and then users data with pnp-sp-js siteUsers but jobTitle is missing. What is the other way to get users job title or am I doing something wrong?
let tempData = await pnp.sp.web.lists
.getByTitle(this.props.list)
.items.getAll();
console.log(tempData);
let users = [];
for (let i = 0; i < tempData.length; i++) {
users[i] = await pnp.sp.web.siteUsers.select("jobTitle").getById(tempData[i].userId).get();
}