I need to update the CreatedBy(Author) field using CSOM Powershell Sharepoint Online.
I tried:
$user=$ctx.Web.EnsureUser("[email protected]")
$ctx.Load($user)
$ctx.ExecuteQuery()
$listItem["Author"]=$user
$listItem.Update()
$ctx.ExecuteQuery()
But this is not updating .I have given mailid to EnsureUser() method because I have only mailId of the user.
can anyone help me with correct solution.