HI Guys, how can i archive the data from sharepoint that has been deleted and moved to recycle bin folder

Anonymous
2022-06-21T15:02:31.547+00:00

HI Guys, how can i archive the data from sharepoint that has been deleted and moved to recycle bin folder

Can i create a archive list or folder and move the deleted list item to that one?

Please help

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Xuyan Ding - MSFT 7,601 Reputation points
    2022-06-23T07:20:26.263+00:00

    Hi @Anonymous ,
    1.If you just want to archive the information of deleted file without content, you could try importing information into csv from Recycle Bin using PowerShell.

    Here is a sample script to get the Recycle Bin report using PnP PowerShell for your reference:

        #Get the PnP PowerShell module  
        ##Skip this line if you already have it  
        Install-Module SharePointPnPPowerShellOnline  
    
        #Config Variables  
        $SiteURL = "<SiteURL>"  
        $Username = "<GlobalAdminAccount>"  
        $Password = "<Password>"  
        $FilePath = "C:\Temp\RecycleBin.csv"  
    
        #Connect to PnP Online  
        $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $(convertto-securestring $Password -asplaintext -force)  
        Connect-PnPOnline -Url $SiteURL -Credential $cred  
    
        #Get Recycle bin Items  
        Get-PnPRecycleBinItem | Select Title, ItemType, Size, ItemState, DirName, DeletedByName, DeletedDate | Export-Csv $FilePath -NoTypeInformation  
    

    214163-image.png

    Here’s the resource: SharePoint Online: Search Recycle Bin using PowerShell
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    2.If you need to restore or backup the complete file content from the recycle bin to a specific folder, maybe you need to manually restore the files one by one and move to folder, because the recycle bin saves the original location information of the deleted files, and the design can only restore to the original location.

    3.Provide you with an idea of ​​using Power Shell to perform the second mode of operation, which is essentially restore first and then move.
    1)Filter out the files from the above csv and get the title and original location of the file. The purpose of filtering is to classify files into the library, in case the library or list in the recycle bin fails to move.
    2)Concatenate original location and title into file URL.
    3)Restore the entire recycle bin.
    4)Move the file to the archive library by looping through the previously fetched deleted file URL.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.