locked
Restore-PnpRecycleBinItem:Llist view limit RRS feed

  • Question

  • Hi,

    I want to restore more then 50.000 files from a  SharePoint (online) site. I am using a powershell script for it, tested it with a test site and a small amount of files and everything works. But I keep getting an error when I try to restore more then 50.000 items.

    Get-PnPRecycleBinItem : The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
    How can I restore this amount of files?
    Monday, February 18, 2019 6:08 PM

All replies

  • Hi,

    It exceeds the List View Threshold. The default of List View Threshold is 5000 items. For SharePoint Online, the List View Threshold limit can't be changed.

    You can batch them smaller, and then restore them in batch.

    For example:

    Get-PnPRecycleBinItem | select -last 2000


    Best regards,

    Linda


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, February 19, 2019 3:11 AM
  • Hi,

    Is there any update?

    Does the information resolve your question?

    If it is useful, please mark it as the answer.

    Best regards,

    Linda


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, February 21, 2019 9:08 AM
  • Well I still get “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator”  even with using the select -last 100
    Tuesday, February 26, 2019 8:30 AM
  • Hi,

    Did you find a solution for it? I'm facing the same problem.

    Thanks!


    Rodrigo Daphanis

    Thursday, May 30, 2019 9:40 PM
  • I'm still getting the list view threshold message.

    The Get function has to get the entire list first, before applying the "select -last #" filter (I'm assuming) which is why that technique doesn't work.

    Thursday, July 18, 2019 6:19 AM
  • Facing the same issue but when I'm trying to clear the recyclebin...

    Any thoughts?

    Friday, August 23, 2019 10:09 AM
  • I am afraid this will not work because Get-PNPRecycleBinItem will execute first and try to load all recycle bin items, exceeeding the 5000 item limit prior to hitting the pipe. 

    The PNP Cmdlets are flawed and do not offer a solution, you will have to turn to CSOM: 

    Site site = clientContext.Site;
    clientContext.Load(site);
    clientContext.ExecuteQuery();
    
    RecycleBinItemCollection items = site.GetRecycleBinItems(null, 5000, false, RecycleBinOrderBy.DeletedDate,
                    RecycleBinItemState.FirstStageRecycleBin);
    clientContext.Load(items);
    clientContext.ExecuteQuery();
    
    items.DeleteAll();
    clientContext.ExecuteQuery();

    Friday, December 6, 2019 1:14 PM
  • I've been trying to use the CSOM method, but there does not appear to be any method like GetRecycleBinItems in the site (or web) context. There is site.RecycleBin, which is a RecycleBinItemCollection type, but that's it. A bit stuck with this. I can't believe how inadequate Microsoft's recycle bin restoration process is. We have a large site, lots of deleted items - a week ago someone inadvertently deleted over 4000 items!
    Monday, February 3, 2020 5:45 AM