How to get recycle bin items in a SharePoint Online Site

This script allows to get all the items contained in the recycle bin of a SharePoint Online (SPO) site. The script defines a function that uses the Client Side Object Model (CSOM) to get all the recycle bin items in a SPO Site. Bear in mind that the information got from recycle b

 
 
 
 
 
(0)
614 times
Add to favorites
Office 365
6/11/2016
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Totals and all users results
    2 Posts | Last post September 24, 2018
    • The results are shown for the username in the script and are not the global contents of the recycle bin. I ran the script but this got me wondering if its possible to modify and obtain the total items and total storage as well as the items themselves and also a variant which lists the global results not just for the user specified?
    • Ey Ben,
      It should be possible to get all the ítems also with CSOM. I don't have a script now to do that, but the API should provide all the information.
  • The remote name could not be resolved
    2 Posts | Last post November 24, 2017
    • Hi Juan,
      
      I tried to run your script (Windows 2016, using the SharePoint Online Management Shell DLLs for CSOM), but I get the following error (tenant name replaced by ***):
      
      System.Net.WebException: The remote name could not be resolved: '***.onmicrosoft.com'
         at System.Net.HttpWebRequest.GetResponse()
         at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetIdcrlHeader(Uri url, Boolean alwaysThr
      owOnFailure, EventHandler`1 executingWebRequest)
         at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetAuthenticationCookie(Uri url, String u
      sername, SecureString password, Boolean alwaysThrowOnFailure, EventHandler`1 executingWebRequest)
         at Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationCookie(Uri url, Boolean refresh, Boolean
      alwaysThrowOnFailure)
         at Microsoft.SharePoint.Client.ClientRuntimeContext.SetupRequestCredential(ClientRuntimeContext context, HttpWebReque
      st request)
         at Microsoft.SharePoint.Client.SPWebRequestExecutor.GetRequestStream()
         at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
         at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
         at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
         at CallSite.Target(Closure , CallSite , Object )
    • My bad, remote name should have been "***.sharepoint.com". I get a list now, but this looks like I only get then items I deleted myself, instead of all items (used credentials are from the SharePoint tenant admin).