Whether this issue occurs in a specific folder, a specific library or a specific site collection?
Whether the folder has unique permission? Have you enabled versioning and approval in the library?
1.Go to library settings -> Manage files which have no checked in version -> Make sure all files are checked in.
2.Go to Microsoft 365 admin center -> Security -> Policies -> Retention.
3.Try to delete folder by using PowerShell.
#Config Variables
$SiteURL = "https://tenant.sharepoint.com/sites/emilytest"
$ListName ="Branding"
$FolderServerRelativeURL = "/sites/emilytest /doc/test"
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin
#Get All Items from Folder in Batch
$ListItems = Get-PnPListItem -List $ListName -FolderServerRelativeUrl $FolderServerRelativeURL -PageSize 2000 | Sort-Object ID -Descending
#Powershell to delete all files from folder
ForEach ($Item in $ListItems)
{
Remove-PnPListItem -List $ListName -Identity $Item.Id -Recycle -Force
Write-host "Removed File:"$Item.FieldValues.FileRef
}
}
Catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
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.
I had this same issue, instead of deleting the folder try moving the folder to an unused Teams document library. Example...right click on the folder in your OneDrive and Click "View Online". Once open in the browser, select the folder you want to get rid of, i.e Documents -> Test1, now click Move. Select a different Sharepoint site to move it to.. in my case it was just a Test Team that isn't used. The folder and subfolders successfully moved to the unused Team, and now I don't have to deal with those folders in my personal One Drive.