SharePoint Pals
 | Sign In
Placing a Office 365 group on legal hold and accessing content from a Preservation Hold Library
by Sriram Varadarajan 25 Jul 2016
Enterprise Architect
Today  :   1     Total  :    1595

The site created for Office 365 group can be put on hold. Any content deleted shall be moved to Preservation Hold Library. But, accessing “Preservation Hold Library “from UI is currently a challenge since site contents page redirects users to the document library again. This seems to be expected since adding new lists such as document library is not allowed in this site. To ensure this, the site contents seems to have been blocked and instead redirects to document library again.

I would appreciate everyone to read my previous article to know about e-Discovery, this article would be a continuation of that.

Here are the list of workarounds that can be done to access the contents

1. We can use SharePoint designer to access this contents. We can browse to the library and copy the contents from SharePoint designer

2. We can open the site in explorer view and copy the content.

3. Following PowerShell script that browses to the library and downloads the file in mentioned location.

 $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
 $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
 $webUrl = Read-Host -Prompt "HTTPS URL for your SP Online 2013 site" 
 $username = Read-Host -Prompt "Email address for logging into that site"
 $password = Read-Host -Prompt "Password for $username" -AsSecureString
 $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl) 
 $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
 $ctx.RequestTimeout = [System.Threading.Timeout]::Infinite
 $web = $ctx.Web
 $list=$web.Lists.GetByTitle("Preservation Hold Library");
 $query=new-object Microsoft.SharePoint.Client.CamlQuery
 $destinationPath = "" #Enter location within quotes
 function recur_folder($item,$destinationPath)
 if($item.FileSystemObjectType -ne "File")
         $folderName = $item["FileLeafRef"];
         $folderPath1 = $item["FileRef"];
         New-Item -ItemType directory -Path $pathOfFolder;
         $folderQuery=New-Object Microsoft.SharePoint.Client.CamlQuery;
         $pathOfFolder= $pathOfFolder+"\"
         foreach($folderItem in $folderItems)
             recur_folder $folderItem $pathOfFolder  
          Write-Host "Saving " $item["FileRef"]
          $fileRef = $item["FileRef"]
          $fileInfo = [Microsoft.SharePoint.Client.File]::OpenBinaryDirect($ctx,$fileRef.ToString())
          $new = $destinationPath + $item["FileLeafRef"]
          [byte]$byte = ""
          $list = New-Object System.Collections.Generic.List[byte]
          try {
          while(($byte = $fileInfo.Stream.ReadByte()) -ne -1)
          } catch [Exception] {
          [System.IO.File]::WriteAllBytes($new, $list.ToArray());
 foreach($item in $items)
 recur_folder $item $destinationPath


MS is the process of fixing this issue with the new Security and compliance roadmap…

blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter October 21, 21:34
How to Add a JS Link Reference to the Display Form or Any other ASPX Programmatically using CSOM PNP in SharePoint -

Twitter October 20, 13:01
How to Add a JS Link Reference to the NewForm and EditForm Programmatically using CSOM PNP in SharePoint Office 365-

Twitter October 12, 12:15
How to Deploy Provider Hosted Apps (Add-Ins) by App Stapling in SharePoint Office 365 -

Twitter October 11, 13:39
How to Deploy Provider HostedApp programmatically using CSOM in SharePoint Office 365 Activating Developer Feature -

Twitter October 10, 09:26
How to Use Angular HTTP Services in SharePoint List -

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation