Set-SPOListItem with multi-value people column


If I do Set-SPOListItem with string variable it gives error. Please see following:


$value="David Longmuir","Conf Room Stevens"

Set-SPOListItem -List $bidDetailsList -Web $web -Values @{$key=$value} -Identity $itemCheck.Id


Error: Set-SPOListItem : The specified user "David Longmuir","Conf Room Stevens" could not be found.


The following line works:

Set-SPOListItem -List $bidDetailsList -Web $web -Values @{$key="David Longmuir","Conf Room Stevens"} -Identity $itemCheck.Id


What is the best way to set the multi-value people field using a variable?  As obviously I cannot hard code the usernames.

2 Replies

You can try


Set-SPOListItem -List $bidDetailsList -Web $web -Values @{$key=$value} -Identity $itemCheck.Id

$value=@("David Longmuir","Conf Room Stevens")

best response confirmed by Umair Naeem (Visitor)

Hi @Umair Naeem


I got this to work by doing the following:


$peopleArr = @()

$peopleArr += ""
$peopleArr += ""

Set-SPOListItem -List "testlist" -Identity 1 -Values @{"People"=$peopleArr}


I've now updated my blog post about this to include multi people columns: