I have the following CSOM code:-

Microsoft.SharePoint.Client.Group group = context.Web.SiteGroups.GetByName(webname);
FieldUserValue[] values = null;

now i want to add all the users inside the group to the FieldUserValue[], but i am not sure how i can convert the User to FieldUSerValue? Thanks


You can refer to the below code :

$userName = “domain\username”
 $spuser = EnsureUser $context      $userName
$lookupValue = @() 
if($spuser -ne $null){ 
$spuserValue = New-Object   Microsoft.SharePoint.Client.FieldUserValue
 $spuserValue.LookupId =   $spuser.id 
 $lookupValue += $spuserValue
  $userValue =      [Microsoft.SharePoint.Client.FieldUserValue[]]$lookupValue 
 $listItem[“Your People Picker   FieldColumn name”] = $userValue

Source :

How to Set People Picker value in SharePoint using CSOM and Powershell?

SharePoint Online: Read / Update Person or Group Field (People Picker) Values using PowerShell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.