unable to delete folder

Glenn Maxwell 10,046 Reputation points
2021-06-21T14:03:25.367+00:00

Hi All

I have an office365 unified group and one of my user is the member of the unified group. When users logs into the team site and deletes one of the folder, the folder doesn't get deleted.
For example. user logsin to the team site-->https://mydomain.sharepoint.com/sites/myteamsite01/Shared%20Documents/Forms/AllItems.aspx?viewid............

Documents-->Folder1-Folder2
The user wants to delete Folder2 and all the contents inside folder2, when user tries to delete the folder2. The user gets the prompt
Are you sure you want to send this item to the site recycle bin and when he clicks delete nothing happens.

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,204 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,553 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,160 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,793 questions
0 comments No comments
{count} votes

Accepted answer
  1. CaseyYang-MSFT 10,321 Reputation points
    2021-06-22T09:00:51.237+00:00

    Hi @Glenn Maxwell ,

    Whether other users occur this issue? Whether this issue occurs in other browsers? Any error message appearing after user deleted the folder?

    Please make sure files are checked out by other users.

    Whether there are retention policies in this document library? You might have to either disable or exclude the respective hold policy that's causing the issue. And please check whether your site have exceeded its storage limit.

    As a workaround, you could use PowerShell codes to delete folders:

    PowerShell codes:

    Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking  
         
    #Variables for Processing  
    $SiteUrl = "https://your team site url"  
    $FolderURL="Shared Documents/your folder name"  
      
    Try {  
        #Get Credentials to connect  
        $Cred = Get-Credential  
        $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)  
      
        #Setup the context  
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)  
        $Ctx.Credentials = $Credentials  
        $Web = $Ctx.Web  
      
        #Get the folder object from given URL  
        $Folder=$web.GetFolderByServerRelativeUrl($FolderURL)  
           
        #sharepoint online powershell delete folder in document library  
        $Folder.DeleteObject()  
        $Ctx.ExecuteQuery()  
      
        Write-host "Folder deleted Successfully!" -ForegroundColor Green  
    }  
    Catch {  
        write-host -f Red "Error deleting Folder!" $_.Exception.Message  
    }  
    

    For Reference:
    https://learn.microsoft.com/en-us/sharepoint/troubleshoot/administration/unable-to-delete-files


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    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

1 additional answer

Sort by: Most helpful
  1. Glenn Maxwell 10,046 Reputation points
    2021-06-23T19:50:25.633+00:00

    i want to delete test2 folder and all its contents, the Test2 folder which is under Documents-->Test1-->Test2
    so what should be $FolderUrl should it be $FolderUrl="Documents/Test1/Test2"

    is the below syntax correct
    $SiteUrl = "https://mydomain.sharepoint.com/sites/mysite/Shared%20Documents/Forms/AllItems.aspx"
    $FolderUrl="Documents/Test1/Test2"