AlHal2
asked on
Insert People Picker into sharepoint online list
I have put the zip file from https://www.c-sharpcorner.com/article/pnp-people-picker-control-for-spfx/ into a webpart (after unzipping it). I'm trying to update my Sharepoint list.
With the PersonName field (Set as Person or Group in Sharepoint online) commented out it works. However when the PersonName field is not commented out it fails with this message. I followed the import instructions, but was wondering if my node modules directory is incorrect or if there is a difference between the Sharepoint used and my version of sharepoint online.
``` , Microsoft.SharePoint.Clien t.InvalidC lientQuery Exception" ,"message" :{"lang":" en-US","va lue":"A node of type 'PrimitiveValue' was read from the JSON reader when trying to read the entries of a feed. A 'StartObject' or 'EndArray' node was expected."}}} at new HttpRequestError (d:\spfx-pnp-people-picker \dist\pn-p -people-pi cker-web-p art.js:236 4:29) at d:\spfx-pnp-people-picker\ dist\pn-p- people-pic ker-web-pa rt.js:2373 :21
With the PersonName field (Set as Person or Group in Sharepoint online) commented out it works. However when the PersonName field is not commented out it fails with this message. I followed the import instructions, but was wondering if my node modules directory is incorrect or if there is a difference between the Sharepoint used and my version of sharepoint online.
```
@autobind
private addSelectedUsers(): void {
sp.web.lists.getByTitle("AlistairTest").items.add({
Title: getGUID(),
//With these lines commented out it works. I changed the field name from User to PersonName when
//I created the column.
PersonName: {
results: this.state.addUsers
}
}).then(i => {
console.log(i);
});
}
```
Failed to load resource: the server responded with a status of 400 () [https://bhfonline.sharepoint.com/teams-and-projects/dev/halperna/_api/web/lists/getByTitle('AlistairTest')/items] Error: Error making HttpClient request in queryable [400] ::> {"odata.error":{"code":"-1ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.