Forum Discussion

bynum's avatar
bynum
Iron Contributor
Jan 22, 2019

Is it possible to disconnect a site from an O365 group?

I'm interested in keeping a site collection that is connected to an Office 365 group, but I want to delete the group and "disconnect" it from the site (basically the opposite of what is possible when you "groupify" a team site). Does anyone know if this is a PowerShell command?

13 Replies

  • JosLieben's avatar
    JosLieben
    Iron Contributor

    Yes this is possible and quite simple, just run Set-SPOSite with the -cleargroupid parameter 

    ref: https://www.lieben.nu/liebensraum/2025/12/microsoft-office-server-directory-directoryobjectnotfoundexception/

    • Arcalight's avatar
      Arcalight
      Tin Contributor

      This was exactly what I needed. I had an orphaned SharePoint site where someone deleted the Team which deleted the M365 group. Our SharePoint sites are all on a retention hold so it wasn't deleted, but the users could no longer access the site because the group was gone. The site's GroupID was still holding the deleted group's value, so I couldn't associate a new group with it. Using the cmdlet you posted cleared the GroupID, which allowed me to create a new group associated with the site. Cheers!

      Just for further info in case someone else has this problem, I created the new group by going to https://ORG.sharepoint.com/sites/SITE/_layouts/creategroup.aspx?mode=connectgroup. That takes you to a wizard to setup a new group for the site that only works after the GroupID field is cleared.

  • johnboy1970's avatar
    johnboy1970
    Copper Contributor

    bynum Agreed. What a mess in Azure when you create a Team Site? An O365 Microsoft Group is auto-created as the name of the site, but the Groups <Site Name> Owners, < Site Name> Members and <Site name> Visitors are created. Now for some reason the <Site Name> Owners is no longer selectable in SharePoint Online (someone may have deleted) and yet still shows as exists in Members of Site. So basically I need to do the same as disconnect this site from the O365 Group.    

    • johnboy1970's avatar
      johnboy1970
      Copper Contributor

      This is after waiting days so has surpassed the 24 hour period.

    • Praveen_Battula's avatar
      Praveen_Battula
      Tin Contributor

      AndrewWarland bynum  I didn't try this. But, you can take a look at the command available in PowerShell. 

       

      https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/remove-spositegroup?view=sharepoint-ps

       

      -Praveen.