2

I have a SPO list where the threshold has exceeded the threshold of 5000. I need to remove 6761785 items and counting.

I have tried to use the following PNP but not having much joy

$items=Get-PnPListItem -List e517d0da-3c1c-47cd-946d-9d295c52f1cd -PageSize 1000
foreach ($item in $items)
{
Write-Host "Getting Items for ListItemID=$($item.Id)" -ForegroundColor Green
try
    {
    Remove-PnPListItem -List “e517d0da-3c1c-47cd-946d-9d295c52f1cd” -Identity $item.Id -Force
    Write-Host "Removing ListItemID=$($item.Id)" -ForegroundColor Red
    }
catch
            {
            Write-Host “error”
            }

}
#---------------------------------------------------------------------------------------------------------#
  • Any advise welcome.

Thank you

1 Answer 1

0

Per my test in my SharePoint online environment, the PnP PowerShell in your post can work fine.

And you also could export the list to the excel file and delete the original list. Then import the excel file to the new list.

And you could choose the data in excel file to import to the new list.

To export to excel in list in SharePoint online, you could refer to the article below.

Export to Excel from SharePoint.

https://support.office.com/en-us/article/Export-to-Excel-from-SharePoint-bfb2ea48-6118-4fa9-abb6-cced9424e5d9

To import excel file to SharePoint list, you could refer to the article below.

Create a list based on a spreadsheet.

https://support.office.com/en-us/article/Create-a-list-based-on-a-spreadsheet-380cfeb5-6e14-438e-988a-c2b9bea574fa

2
  • Thank you Amy. How would I export to excel and clear and re-import?
    – S60AUN
    Commented Dec 19, 2017 at 20:19
  • I have updated my reply.
    – Amy_MSFT
    Commented Dec 20, 2017 at 7:45

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.