SharePoint (2003 thru Online): Restore the Team in Microsoft Teams using SharePoint Online Management Shell

Monday, April 9, 2018

Restore the Team in Microsoft Teams using SharePoint Online Management Shell

IMPORTANT: As a best practice, we recommend always staying current: uninstall the old AzureADPreview version and get the latest one before you run SharePoint Online Management Shell commands.

In your search bar, type SharePoint Online Management Shell. Pin it to the Taskbar.

Right-click on SharePoint Online Management Shell. and select Run ISE as Administrator.


To uninstall a previous version of AzureADPreview, run this command:

Uninstall-Module AzureADPreview

To install the latest version of AzureADPreview, run this command:

Install-Module AzureADPreview


At the message about an untrusted repository, Click on "Yes to All". It will take a minute or so for the new module to install.

Restore the deleted Team

Note: You must have Office 365 global admin or organization management permissions.
Install the most current preview version of AzureADPreview module,  to make sure these steps work for people.
Run the following command to connect to Azure AD

Connect-AzureAD

In the Sign in to your Account screen that opens, enter your Office 365 admin account and password to connect you to your service, and click Sign in.



Run this command to display all soft-deleted Office 365 groups in your organization that are still within the 30 day retention period:


Get-AzureADMSDeletedGroup

Take note of the object ID of the group, or groups, you want to restore. If you don't see the group you're looking for on this list then it has likely been purged permanently.

Caution: If a new group has been created with the same alias or SMTP address as your deleted group, you will have to delete that new group before you'll be able to restore your deleted group.

To restore that group run this command:

Restore-AzureADMSDeletedDirectoryObject –Id <objectId>

This process usually takes just a few minutes but in a few rare cases it can take as long as 24 hours to completely restore. To verify that the group has been successfully restored, run this command in PowerShell:

Get-AzureADGroup –ObjectId <objectId>

Once the restore has successfully completed, the group should reappear on the navigation pane in Outlook and Outlook on the web. All restored content, including SharePoint, Microsoft Team and Planner, should be available to the group members again.
_________________________________________________________________________________
Permanently delete the Team in Microsoft Teams

Sometimes you may want to permanently purge a group without waiting the 30 days for the soft-delete to expire. To do that, start PowerShell and run this command to get the object ID of the group:

Get-AzureADMSDeletedGroup

Take note of the object ID of the group, or groups, you want to permanently delete.

Caution: Removing the group removes the group and its data forever.
To remove the group run this command in PowerShell:

Remove-AzureADMSDeletedDirectoryObject –Id <objectId>

To confirm that the group has been successfully purged, run the Get-AzureADMSDeletedGroup cmdlet again to confirm that the group no longer appears on the list of soft-deleted groups. In some cases it may take as long as 24 hours for the group and all of its data to be permanently deleted.

No comments:

Post a Comment