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
Author
Enterprise Architect
Visits   
Today  :   4     Total  :    2494

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
 $ctx.Load($web);
 $ctx.ExecuteQuery();
 
 $list=$web.Lists.GetByTitle("Preservation Hold Library");
 $ctx.Load($list);
 $ctx.ExecuteQuery();
 
 $query=new-object Microsoft.SharePoint.Client.CamlQuery
 $query.ViewXml="<View><Query><Where></Where></Query></View>";
 $items=$list.GetItems($query);
 $ctx.Load($items);
 $ctx.ExecuteQuery();
 
 $destinationPath = "" #Enter location within quotes
 
 function recur_folder($item,$destinationPath)
 {
 if($item.FileSystemObjectType -ne "File")
     {
         $folderName = $item["FileLeafRef"];
         $folderPath1 = $item["FileRef"];
         $pathOfFolder=$destinationPath+$folderName
         New-Item -ItemType directory -Path $pathOfFolder;
         $folderQuery=New-Object Microsoft.SharePoint.Client.CamlQuery;
         $folderQuery.ViewXml="<View><Query><Where></Where></Query></View>";
         $folderQuery.FolderServerRelativeUrl=$folderPath1;
         $folderItems=$list.GetItems($folderQuery);
         $ctx.Load($folderItems);
         $ctx.ExecuteQuery();
         $pathOfFolder= $pathOfFolder+"\"
         foreach($folderItem in $folderItems)
         {
             recur_folder $folderItem $pathOfFolder  
         }
     }
     else
     {
          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)
          { 
          $list.Add($byte)
          }
          } catch [Exception] {
          }
          [System.IO.File]::WriteAllBytes($new, $list.ToArray());
          $fileInfo.Dispose() 
          }
             }
             
  
 foreach($item in $items)
 {
 recur_folder $item $destinationPath
 }  
 

Conclusion:

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

blog comments powered by Disqus

SharePoint Pals

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

Training

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 articles@sharepointpals.com in a word document.

Related Resources

Recent Tweets

Twitter January 15, 00:25
How To Enable Target Value And Actual Value In #D3 Gauge Chart https://t.co/VxSi4QnNrC

Twitter January 15, 00:24
How To Open #SharePoint List Hyperlink Column In Modal #Popup Window https://t.co/EQ7HkoZDkX

Twitter January 15, 00:24
Quick Introduction To #Asp.NetCore And It’s Features https://t.co/zAXObHCFpH

Twitter January 15, 00:22
How To Configure #PerformancePoint Services To Use Secure Store In #SharePoint 2013 https://t.co/LEwnUoI7EY

Twitter January 15, 00:21
How To Block Or Disable #Office365 Services https://t.co/Yvp2VPFIRP

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