SharePoint Online: Delete Drop Off Library using PowerShell

Requirement: Remove drop off library in SharePoint Online.

Site owner activated “Content Organizer” feature in a site which brought “Drop Off  Library” into the SharePoint Online site. Now, when he tried deleting this library by going to library settings, he could not find “Delete this document library” link in the library’s settings! Deactivating the content organizer feature didn’t help. So, How to delete the drop off library from SharePoint Online?

delete drop off library in sharepoint online

As the drop off library doesn’t provide the “Delete this Library” link, we’ve to use PowerShell to delete this library.

SharePoint Online Remove drop off library using PowerShell:

We can delete the Drop Off Library by setting: AllowDeletion property. Here is the PowerShell script to delete the drop off library in SharePoint Online.

#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"
##Variables for Processing
$SiteUrl = ""

Try { 
    #Get Credentials to connect
    $Cred= Get-Credential
    $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    #Set up the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
    $Ctx.Credentials = $credentials
    #Get the Drop Off Library
    $Library = $Ctx.web.Lists.GetByTitle("Drop Off Library")

    #Set Allow Deletion Property
    $Library.AllowDeletion = $True

    #Delete the Library

    Write-Host -f Green "Drop Off Library Deleted Successfully!"
Catch {
    write-host -f Red "Error Deleting Drop Off Library!" $_.Exception.Message

PnP PowerShell to Delete a Drop-OFF library in SharePoint Online

You can also use PnP PowerShell to delete the drop off library.

$SiteURL = ""
$LibraryName="Drop Off Library"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin
#Get the Library to Delete
$Library = Get-PnPList -Identity $LibraryName -ErrorAction SilentlyContinue
#Check if Library exists
    #Allow Deletion
    $Library.AllowDeletion = $True
    #delete library in sharepoint online powershell
    Remove-PnPList -Identity $LibraryName -Recycle -Force
    Write-host -f Green "Library '$LibraryName' Deleted Successfully!"
    Write-host -f Yellow "Could not find Library '$LibraryName'"

In SharePoint On-premises also, you can remove any document library or list by setting: “AllowDeletion” to “True” as in my other article: How to Delete any Document Library or List in SharePoint using PowerShell?

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply