Forum Discussion
Cardinal_Night
Nov 19, 2019Brass Contributor
How to set the default for a pnp.sp people picker
I want a pnp.sp people picker to auto populate with the logged in user. Here's the render and the people picker: <PeoplePicker
context={this.props.context}
personSelectionLimit={1}
grou...
Cardinal_Night
Nov 27, 2019Brass Contributor
O365Developer I think that you are correct but I'm not sure how to force the people picker to change on render. How would I do this?
Guruprasad1380
Apr 26, 2020Copper Contributor
How did you resolve ur issue ? Even i m trying to default users.. basically i get more than 5 users email from webservice, always these people new means (info wont be available in user information list) its a hidden people picker would like to prepopulate and save the item.. any idea how do i auto bind and trigger change event and capture usersid list so i can create item with the people picker column in the list?
- Carlos_MarinsApr 27, 2020Iron Contributor
Hey Guruprasad1380,
I was able to get the default user using its title as the key for the defaultSelectedUsers property. In my componentDidMount, I get the user using the sp.web.currentUser.get() method, store it in the state and then pass [this.state.me.Title] to the defaultSelectedUsers property of the picker. Let me know if it doesn't work for you.
Regards