I recently had to do something similar and I used the Creator kit, specifically the PeoplePicker component and I really liked it.
In my case, in the SharePoint list, I created a People type column with multiple selection with the name Persons
- In OnLoad of the screen where I have the component, I put the following:
ClearCollect(
colPersons,
ForAll(
recordSelectedFromSharePoint.Persons As participantRecord,
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Department: participantRecord.Department,
Claims: participantRecord.Claims,
DisplayName: participantRecord.DisplayName,
Email: participantRecord.Email,
JobTitle: participantRecord.JobTitle,
Picture: participantRecord.Picture
}
)
)
- The Items property of the PeoplePicker component, I set it with the value of the collection above: colPersons
- The PersonaKey property, I set it with the value of the field in collection above (colPersons): Email
- The PersonaKey property, I set it with the value of the field in collection above (colPersons): DisplayName
- The OnSearch property, I set the value:
ClearCollect(
colOffice365Users,
AddColumns(
Filter(
Office365Users.SearchUser(
{
searchTerm: Self.SearchText,
top: 100
}
),
!(Mail in Self.SelectedPeople.PersonaKey)
),
"SuggestionImgUrl",
Substitute(
JSON(
Office365Users.UserPhotoV2(Id),
JSONFormat.IncludeBinaryData
),
"""",
""
),
"SuggestionKey",
Mail,
"SuggestionName",
DisplayName,
"SuggestionRole",
JobTitle,
"SuggestionPresence",
"away"
)
)
- The Suggestions_Items property, I set it with the collection above: colOffice365Users
- To save the list item with the selected people this is what I put:
ClearCollect(
colPersons,
ForAll(
pickerUsers.SelectedPeople As participantRecord,
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Department: "",
Claims: "i:0#.f|membership|" & participantRecord.PersonaKey,
DisplayName: participantRecord.PersonaName,
Email: participantRecord.PersonaKey,
JobTitle: "",
Picture: ""
}
)
);
//If recordSelectedFromSharePoint exists, Update else Create
Patch(
SP_List_Name,
Coalesce(
LookUp(
SP_List_Name,
ID = recordSelectedFromSharePoint.ID
),
Defaults(SP_List_Name)
),
{
Title: txtTitle.Value,
Persons:colPersons
}
);
In this case, I do not use form to save the information, I save it manually doing a Patch.