NightTom
NightTom

Reputation: 486

What is the format for the defaultSelectedUser property for this People Picker?

I'm trying to populate this people picker with multiple users stored in seperate Person columns in an SP list.

This is the control: https://pnp.github.io/sp-dev-fx-controls-react/controls/PeoplePicker/

And the property is the defaultSelectedUsers, I use this to populate the PP when an item is retrieved from the SP list. Here is the People picker:

<PeoplePicker
   context={this.props.context}
   personSelectionLimit={3}
   groupName={''} // Leave this blank in case you want to filter from all users
   showtooltip={false}
   isRequired={false}
   disabled={false}
   selectedItems={this._getPanellistsPickerItems}
   showHiddenInUI={false}
   defaultSelectedUsers={panellists ? panellists : []}
   principalTypes={[PrincipalType.User]}
   resolveDelay={1000}
   ensureUser={true}
  />

The panellists is an array which output looks like this:

(3) ["[email protected]", "[email protected]", "[email protected]"]
0: "[email protected]"
1: "[email protected]"
2: "[email protected]"
length: 3
__proto__: Array(0)

But it's not putting anything into the PP on retrieval. I'm stringifying the array, but not sure if that's the correct format for the aforementioned property.

Upvotes: 0

Views: 1668

Answers (1)

Baker_Kong
Baker_Kong

Reputation: 1889

@Tom,

I tested this control in my SPO with below array, it works well here:

enter image description here

enter image description here

Below is my test demo, you may take a look:

Upvotes: 2

Related Questions