Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestoreSiteCollection is not restoring the associated Site Collection Group #801

Closed
1 task done
gavdgavd opened this issue Mar 29, 2022 · 3 comments
Closed
1 task done
Assignees
Labels
area:admin 📜 Admin library related bug Something isn't working

Comments

@gavdgavd
Copy link

Category

  • Bug

Describe the bug

Using the RestoreSiteCollection command to restore a deleted SharePoint Site Collection that is in the Recycle Bin, restores the Site Collection, but not its associated Group.

Steps to reproduce

01 - Create a new Team Site Collection using the SharePoint Admin Center (Sites -> Active sites -> Create -> Team site -> give it a name and an administrator)
02 - Review that the new Site Collection do have an associated Group (Microsoft 365 Admin center -> Teams & groups -> Active teams & groups -> a group with the same name as the Site Collection should be visible in the list of Groups)
03 - Delete the Site Collection using the SharePoint Admin Center (Sites -> Active sites -> select the created Site Collection from bullet 01 -> open the menu with the ellipse button (...) -> Delete -> check the check box "Delete the group [GroupName] and all its resources" -> Delete)
04 - Review that the Site Collection is indeed deleted (SharePoint Admin Center -> Sites -> Deleted sites -> the Site Collection must be in the list)
05 - Review that the associated Group is indeed deleted (Microsoft 365 Admin center -> Teams & groups -> Deleted groups -> the Group with the name of the deleted Site Collection should be visible in the list)
06 - Open PowerShell, use the method "Create" or "CreateAsync" to make a PnPContex (authenticate the user) using an Azure App Registration. Set the "SetMinimumLevel" to "LogLevel.Debug" to see verbose logging of the process
07 - Run the next command to restore the Site Collection:
myContext.GetSiteCollectionManager().RestoreSiteCollection(new Uri("https://[domain].sharepoint.com/sites/[SiteCollName]"));
08 - Review in the log shown in PowerShell that there are no errors in the processing
09 - Review in the SharePoint Admin center that the Site Collection is restored (Sites -> Active sites -> Create -> Team site -> the deleted Site Collection should be back in the list)
10 - If you click on the Site Collection name in the list, you will see a message in the properties window saying "We couldn't find the Microsoft 365 Group connected to this site."
11 - Review if the Group is restored using the Microsoft 365 Admin center (Teams & groups -> Active teams & groups -> the Group is not visible in the list)
12 - Review that the Group is still in the deleted groups (Microsoft 365 Admin center -> Teams & groups -> Deleted groups -> the Group with the name of the deleted Site Collection will still be visible in the list)

Expected behavior

The RestoreSiteCollection must restore both elements: the Site Collection and its associated Group. Now it restores only the Site Collection, not the associated Group

Environment details (development & target environment)

  • SDK version: PnP.Core version 1.5.101, PnP.Core.Admin version 1.5.101, PnP.Core.Auth version 1.5.101
  • OS: Windows Server 2022
  • SDK used in: Console App
  • Framework: .NET Core v6.0
  • Browser(s): Chromium Edge v99.0.1150.55 64 bit
  • Tooling: Visual Studio 2022 version 17.1.2 64 bit
  • Additional details: none

Additional context

None

Thanks for your contribution! Sharing is caring.

@jansenbe jansenbe self-assigned this Apr 5, 2022
@jansenbe jansenbe added area:admin 📜 Admin library related question Further information is requested labels Apr 5, 2022
@jansenbe
Copy link
Contributor

jansenbe commented Apr 5, 2022

Thanks for using PnP Core SDK and reporting this issue @gavdgavd , will take a look and report back.

@jansenbe
Copy link
Contributor

jansenbe commented Apr 5, 2022

@gavdgavd : I'm working on an update that will use Microsoft Graph to first restore the group before the actual site collection is restored. Will report back once that's done

@jansenbe jansenbe added bug Something isn't working and removed question Further information is requested labels Apr 5, 2022
jansenbe added a commit that referenced this issue Apr 5, 2022
@jansenbe
Copy link
Contributor

jansenbe commented Apr 5, 2022

@gavdgavd : a fix has been pushed and will appear in the next nightly build (version 1.6.8 or higher). With this fix when restoring a site collection that has a group connected to it the code first tries to restore the Microsoft 365 group. I'll close this issue, but don't hesitate to either re-open or create a new one when you still have issues. Thanks again for using PnP Core SDK and providing feedback.

@jansenbe jansenbe closed this as completed Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:admin 📜 Admin library related bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants