SharePoint Online: “Delete this Document Library” is missing!

Problem: Cannot delete a SharePoint Online document library as the “Delete this Document Library” option is missing in document library settings!

I tried deleting the library from the site contents page, library’s ribbon menu, SharePoint Designer, Content and structure tool, Explorer view, and PowerShell, but none helped!


You may not see the “Delete this list” option if you don’t have “Edit” or more access rights on the SharePoint Online site! Moreover, in some system libraries, the “Allow Deletion” flag is set to “FALSE” to prevent the library from accidental deletions. (E.g., in “Farm Templates”, “Style Library”, etc., delete this Document Library link is missing by default to prevent deletion).

sharepoint online delete this document Library missing

How to enable delete in a SharePoint Online Document Library?

Use this PowerShell to enable Delete in a library by setting the “Allow Deletion” flag to True!

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Set parameter values

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
    #Get the Document Library and set allow deletion flag
    $Library.AllowDeletion = $True
    #Delete the Document Library (Send to Recycle bin)
    $Library.Recycle() | Out-Null
    Write-Host "Document Library: '$LibraryName' has been Deleted Successfully!" -ForegroundColor Green  
Catch {
    write-host -f Red "Error Deleting Document Library!" $_.Exception.Message

The same thing can be achieved with PnP PowerShell:

$SiteURL = ""
$ListName = "Projects"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get the List
$List = Get-PnPList -Identity $ListName
#Enable Delete option for the list
$List.AllowDeletion = $True

This enables deletion on the document library. To delete a document library in SharePoint Online using PowerShell, refer to my other post: SharePoint Online: PowerShell to Delete Document Library

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *