In the following examples we will give a brief about the retention policy scenarios for OneDrive For business.
From compliance center
After and before
After user deleted
Just the contents
Full path and structure of data and folders
The first method
The security and compliance center to retain OneDrive Data, this method is used for retaining data for compliance reasons also the data will be retrieved using content search.
- Comply proactively with industry regulations and internal policies
- Reduce your risk in the event of litigation or a security breach
Help your organization to share knowledge effectively.
data will be retrieved using the search content in the compliance center.
The second Method which is recommended
The result shall look like that after finish go to the URL of the user.
A user’s OneDrive URL is based on their username. For example, https://domain-my.sharepoint.com/personal/user1_domain_com.
Set the OneDrive retention for deleted users
Go to OneDrive admin portal
Enter the number of days you want to keep the OneDrive files in the Days to retain files in OneDrive after a user account is marked for deletion box.
The minimum value is 30 days and the maximum value is 3650 days (10 years).
This is the process of deletion
When the account is deleted
The account deletion is synced to sharepoint and the OneDrive Cleanup job runs OneDrive Marked for deletion the user will appear in the deleted users for 30 days
Retention policies always take precedence to the standard OneDrive deletion process, so content included in a policy could be deleted before 30 days or retained for longer than the OneDrive retention.
Restore the Data.
Let’s start with the restore process installing the sharepoint PowerShell
The following is all the commands needed
#install sherepoint online Module
# connect to your sharepoint tenant
# get list of deleted users URL
#restore the user
# assign admin to open
# When you permanently delete a OneDrive, you will not be able to restore it.
The following is explanation of each command
Now connect to know if the user’s data is available or not
Get-SPODeletedSite -Identity <URL>
A user’s OneDrive URL is based on their username.
For example, https://yourdomain-my.sharepoint.com/personal/user1_contoso_com
Lets say you don’t know his URL then run the following command to get all deleted users
If his username appears then it can be restored
Get-SPODeletedSite -IncludeOnlyPersonalSite | FT url
Then restore onedrive to active state
Restore-SPODeletedSite -Identity <URL>
Assign administrator to view the data
Set-SPOUser -Site <URL> -LoginName <UPNofDesiredAdmin> -IsSiteCollectionAdmin $True
After you finish remove then delete
Remove-SPOSite -Identity <URL>
Remove-SPODeletedSite -Identity <URL>