Have you ever deleted an Office365 account without making a backup? And have you ever had to recover files from that account after 2 months? An Office365 user account can be recovered up to 330 days after deletion from the admin panel. But what happens after that time has passed? Today, I will present a simple way to restore files more than 30 days after the account has been deleted.
Restoring files after 30 days can only be done through PowerShell.
To start, you need to log in to the SharePoint service with an administrative account through PowerShell.
1 |
Connect-SPOService -Url https://<TENANT>-admin.sharepoint.com |
Next, we want to check if the requested resources of the deleted account exist on SharePoint.
1 |
Get-SPODeletedSite -Identity https://<TENANT>-my.sharepoint.com/personal/accountname_domain_pl |
As a result, the following output will be produced:
If the object of our search exists, then we can proceed to recover it using a command
1 |
Restore-SPODeletedSite -Identity https://<TENANT>-my.sharepoint.com/personal/accountname_domain_pl |
We have already restored the files, but we still can’t access them. Now we would need to add permissions for ourselves to this resource. We do this with a command:
1 |
Set-SPOuser https://<TENANT>-my.sharepoint.com/personal/accountname_domain_pl -loginname admin@domain.pl -issitecollectionAdmin $True |
And that’s basically it. Now you need to go to the address that points directly to the requested resource. This is the address: https://<TENANT>-my.sharepoint.com/personal/accountname_domain_pl