This has taken me days to work out (because of my own typos), mainly through trying to piece it together but also through the community board. I thought I'd present it like this from my own notes to help others. If you disagree then please provide feedback.
I will say that one of the things that really got me was Mail vs. Email. Oh boy, was that an epiphany, SP stores it as Email while the table needed in Office365 is Mail.
This is an example for a Power App - Canvas App - with a ComboBox directly on the canvas and not in a form. The data connection is to a SP List.
Single Person is a SP Person/People Column (only allows single entry)
Multiple Person is a SP Person/People Column (allows multiple entries)
Property | Single Person | Multiple Person |
ComboBox Name | ComboBox1 | ComboBox2_1 |
DefaultSelectedItems | Office365Users.SearchUser({searchTerm: varItem.PersonSingle.Email}) ---Or--- { Claims:"i:0#.f|membership|" & Lower(varItem.PersonSingle.Email), Department:"", DisplayName:varItem.PersonSingle.DisplayName, Mail:varItem.PersonSingle.Email, JobTitle:".", Picture:"." } | ForAll(varItem.PersonMultiple, { Claims:"i:0#.f|membership|" & Lower(Email), Department:"", DisplayName: DisplayName, Mail:Email, JobTitle:".", Picture:"." }) |
Items | Office365Users.SearchUser({searchTerm: ComboBox1.SearchText}) | Office365Users.SearchUser({searchTerm: ComboBox2_1.SearchText}) |
DisplayFields | ["DisplayName"] | ["DisplayName"] |
IsSearchable | true | true |
SearchFields | ["DisplayName"] | ["DisplayName"] |
SelectMultiple | false | true |
Patch (triggered by a button) | Patch( 'Test List', LookUp( 'Test List', ID = varItem.ID ), { PersonSingle: { Claims:"i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail), Department: "", DisplayName: ComboBox1.Selected.DisplayName, Email: Lower(ComboBox1.Selected.Mail), JobTitle: "", Picture: "" } } ); | Patch( 'Test List', LookUp( 'Test List', ID = varItem.ID ), { PersonMultiple: ForAll( ComboBox2_1.SelectedItems, { Claims: "i:0#.f|membership|" & Lower(Mail), Department: "", DisplayName: DisplayName, Email: Mail, JobTitle: ".", Picture: "." } ) } ); |
Lastly an example of combining the single and multiple patch as a single patch
Patch(
'Test List',
LookUp(
'Test List',
ID = varItem.ID
),
{
PersonSingle: {
Claims: "i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail),
Department: "",
DisplayName: ComboBox1.Selected.DisplayName,
Email: ComboBox1.Selected.Mail,
JobTitle: "",
Picture: ""
},
PersonMultiple: ForAll(ComboBox2_1.SelectedItems,{
Claims: "i:0#.f|membership|" & Lower(Mail),
Department: "",
DisplayName: DisplayName,
Email: Mail,
JobTitle: ".",
Picture: "."
})
}
);