I try to update a SharePoint Online people field (in a doc list), from PowerShell.

Here's the code:

$properties = $Upload.ListItemAllFields;
$properties["CLT"] = $File.Name.Substring(0,10)
$spcompte = Get-SPOUser -Site https://xxxx.sharepoint.com/ -LoginName "[email protected]" 
$properties["ACCOUNT"] = $spcomte

No problems with a $spcompte.displayname, it shows the correct user,

But $properties["ACCOUNT"] = $spcomte just returns the following :

Exception calling "ExecuteQuery" with "0" argument(s): "Des données non valides ont été utilisées pour mettre à jour l'élément de liste. Le champ que vous essayez de mettre à jour est peut-être en lecture seule." At C:\Sharepoint PowerShell.ps1:50 char:1 + $Context.ExecuteQuery() + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ServerException

Google translate for the error:

Invalid data was used to update the list item . The field you are trying to update may be read only.

Any idea? I see a lot of stuff about Get-SPUser for SharePoint server, but nothing for Online.

  • I would just try setting it with their email address and let it do the validation and everything normally, rather than trying to pass in an object. Commented Jun 26, 2015 at 13:55

2 Answers 2


I have the same problem. I found the solution at last, so I would like to share with you if it helps

$SiteUrl = "Your site URL"

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) 

$Item["Title of column"] = $Context.Web.EnsureUser("e-mail of user") 

Using the below PowerShell script, we can update the people picker column in SharePoint online:

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Set parameter values
$FieldName= "ProjectMembers" #Internal Name
$UserIDs=@("[email protected]","[email protected]","[email protected]")

#Get Credentials to connect
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials

#Get the List & Item to update
$List = $Ctx.Web.lists.GetByTitle($ListName)
$ListItem = $List.GetItemById($ListItemID)

#Resolve each user ID and get the User Objects
$UserValueColl = @()
ForEach($UserID in $UserIDs)
    #Get the User to Update
    $SPOUser = $Ctx.Web.EnsureUser($UserID)

    If($SPOUser -ne $Null)
        $SPOUserValue = New-Object Microsoft.SharePoint.Client.FieldUserValue
        $SPOUserValue.LookupId = $SPOUser.id
        $UserValueColl += $SPOUserValue

IF($UserValueColl.length -gt 0)
    $UserValueCollCollection = [Microsoft.SharePoint.Client.FieldUserValue[]]$UserValueColl
    #Update the Multi-People picker column
    $ListItem[$FieldName] = $UserValueCollCollection
    Write-Host -f Green "List Item has been updated!"

Reference URL:

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 and acknowledge you have read our privacy policy.

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