How to delete the Site Groups of a Sharepoint Site when they are inacessible?

Puneeth, C 81 Reputation points
2022-06-16T14:25:49.11+00:00

I have tried to create some groups for my SharePoint site programmatically and something went wrong while creating these groups.
Now I cannot even open/access the groups to delete them and re-create them properly.
I get the following page when I click on any group that has been created.
212058-11.png

212069-image.png

The ULS logs were not of help either.

Can you please help me with this? I can figure out a way to re-create them properly once I am able to get the existing once deleted.
Thanks in advance.

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,674 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,575 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Xuyan Ding - MSFT 7,561 Reputation points
    2022-06-17T09:02:04.82+00:00

    Hi @Puneeth, C ,

    1.Try to delete site group with Power Shell. Code show as below:

    Add-PSSnapin Microsoft.Sharepoint.Powershell   
    $spWeb = Get-SPWeb "https://sp/sites/yoursite"  
    $GroupName="testgroup"  
    
    if($spWeb.SiteGroups[$GroupName] -ne $null)  
    {  
    $spWeb.SiteGroups.Remove($GroupName)  
    $spWeb.Update()  
    Write-Host "Group Deleted!"  
    }  
    else  
    {  
    Write-Host "Group doesn’t Exists!"  
    }  
    

    2.If Power Shell doesn't work and you still get the "Group cannot be found" error, you'd better check to see if the ID of the group URL has been changed for some reason. Modify the ID and test if it can be deleted.
    Reference to third-party article: SharePoint 2010 “Group cannot be found” error
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Puneeth, C 81 Reputation points
    2022-06-17T10:07:43.767+00:00

    I just deleted the site and re-created it as it was just development environment. Hopefully, there is a sure shot way to fix these issues in case anyone stumbles upon such things on a Prod environment.