Tuesday, November 3, 2015

Restoring Files on OneDrive for Business

Restoring Files on OneDrive for Business

SharePoint Online sites offer end-user and site collection administrator views to the Recycle Bin. The end user can see any items he or she deleted, but you, as a site collection administrator, can see all items deleted by any user within the site collection. You also have access to two recycle bin stages, a first-level Recycle Bin, and a Second-Stage Recycle Bin.

This gives you greater control when users delete files, versions of files, list items, libraries, lists, and folders from a SharePoint site by providing a two-stage safety net before an item is permanently deleted from a site. When a user deletes an item from the team site, it goes to the site Recycle Bin. A user can restore an item he or she deleted from the Recycle Bin, but only you, as a site collection administrator, can restore items deleted by any user. 

Behaviour of items in the first-level (Site) Recycle Bin:

  • Items in the Recycle Bin count against site quota.
  • The site collection administrator sees all items deleted by any user from any site within the site collection.
  • Non-administrator users can see the items they deleted from the site.
  • Items in the Recycle Bin can be sent to the Second-Stage Recycle Bin by the user or the site collection administrator.
  • All items re automatically deleted 93 days after they were originally recycled. 

Behaviour of items in the Second-Stage Recycle Bin:

  • Items in the Second-Stage Recycle Bin don't count against site quota.
  • Items in the Second-Stage Recycle Bin can only be seen by the site collection administrator.
  • Items in the Second-Stage Recycle Bin can only be restored or deleted by the site collection administrator.
  • All items are automatically deleted 93 days after they were originally recycled.
  • All items are automatically deleted when the total storage for the Second-Stage Recycle Bin exceeds 200% of your site collection quota.

I used the SharePoint sites example as OneDrive groups are based on SharePoint team sites. You would follow pretty much the same steps.

Restore an item from the Site Recycle Bin page

As a site collection administrator, you can restore a user’s deleted item to its original location, as long as the item hasn't exceeded the original deleted date that the service administrator set. For SharePoint Online, items in the Recycle Bin are deleted automatically after 93 days.

  1. On the left navigation pane of the Team Site page, choose Recycle Bin.
  2. Select the check box next to the item you want to restore, and then click Restore Selection.

If you restore an item that was originally located in a deleted folder, the folder is recreated in its original location and the item is restored in that folder. 

Restore an item from the Second-Stage Recycle Bin page

If you accidentally emptied the Site Recycle Bin, you can still restore those items from the Second-Stage Recycle Bin as long as they have not been automatically deleted. For SharePoint Online, items in the Recycle Bin are deleted automatically after 93 days.

  1. On the left navigation pane of the Team Site page, choose Recycle Bin.
  2. On the Recycle Bin page choose second-stage recycle bin
  3. Select the check box next to the item you want to restore, and then click Restore Selection.

If you restore an item that was originally located in a deleted folder, the folder is recreated in its original location and the item is restored in that folder.

Recovering items after the 93 days

What happens after the 93 days has past and you as a site collection administrator cannot find the deleted items in the Recycle Bin or the Second-Stage Recycle Bin?

Well, I did not know how to do this either so I called Microsoft. After a couple of calls, and my incident being escalated, they provided me with a Powershell script to run as admin on “SharePoint Online Management Shell”. Once you’ve installed the “SharePoint Online Client Components SDK” from here - http://ift.tt/1Q8DtM3. The script is as follow;

function Restore-AllItems

{

param (

  [Parameter(Mandatory=$true,Position=1)]

                        [string]$Username,

                        [Parameter(Mandatory=$true,Position=2)]

                        $AdminPassword,

        [Parameter(Mandatory=$true,Position=3)]

                        [string]$Url

)

#$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force

  $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)

  $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)

  $ctx.ExecuteQuery()

  $rb=$ctx.Site.RecycleBin

$ctx.Load($rb)

$ctx.ExecuteQuery()

Write-Host $ctx.Site.Url $rb.Count.ToString()

$ctx.Site.RecycleBin.RestoreAll()

$ctx.ExecuteQuery()

}

# Paths to SDK. Please verify location on your computer.

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

 

# Insert the credentials and the name of the admin site

$Username="me@domian.onmicrosoft.com"

$AdminPassword=Read-Host -Prompt "Password" -AsSecureString

$AdminUrl="http://ift.tt/1ROjVuU}"

 

Restore-AllItems -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl


by Larry Saytee via Everyone's Blog Posts - SharePoint Community

No comments:

Post a Comment