My goal is to create a powershell script that will change the created by value in my Sharepoint online documents list. Fyi this list contains 10005 items.
I'm at the very beggining and already stuck because of this error:
Exception calling "ExecuteQuery" with "0" argument(s): "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator."
Here is my script:
##Variables for Processing
$SiteUrl = "https://xyz.sharepoint.com/sites/xyz"
$UserName ="user@xyz.com"
$Password ="xyz"
$ListName ="Documents"
#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
#Setup the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $Credentials
#Get the list (documents)
$Web = $context.Web
$documentsList = $Web.Lists.GetByTitle($ListName)
#Get All List items
$ListItems = $documentsList.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery())
$context.Load($ListItems)
$context.ExecuteQuery()
Write-host "Total Number of List Items found:"$ListItems.count
I want to loop through the list items and change the created by value.
How do you get around the 5000 item limit in this case?
Thank you.