Búsqueda de sitios web

SharePoint Online: eliminar la biblioteca de entrega mediante PowerShell


Requisito: Eliminar la biblioteca de entrega en SharePoint Online.

El propietario del sitio activó la función "Organizador de contenido" en un sitio que incorporó la "Biblioteca de entrega" al sitio de SharePoint Online. Ahora, cuando intentó eliminar esta biblioteca yendo a la configuración de la biblioteca, no pudo encontrar el enlace "Eliminar esta biblioteca de documentos" en la configuración de la biblioteca. Desactivar la función del organizador de contenido no ayudó. Entonces, ¿cómo eliminar la biblioteca de entrega de SharePoint Online?

Como la biblioteca de entrega no proporciona el enlace "Eliminar esta biblioteca", debemos usar PowerShell para eliminar esta biblioteca.

SharePoint Online Eliminar biblioteca de entrega mediante PowerShell

La biblioteca de entrega dirige automáticamente los documentos a su ubicación adecuada en el sitio con una función de organizador de contenido. Una vez que la función está desactivada, podemos eliminar la biblioteca de entrega configurando: la propiedad AllowDeletion. Aquí está el script de PowerShell para eliminar la biblioteca de entrega en 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 = "https://Crescent.sharepoint.com/DocCenter"

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
    $Library.Update()

    #Delete the Library
    $Library.DeleteObject()
    $Ctx.ExecuteQuery()

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

PnP PowerShell para eliminar una biblioteca de entrega en SharePoint Online

También puede usar PnP PowerShell para eliminar la biblioteca de entrega:


#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/Projects/"
$LibraryName="Drop Off Library"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
 
#Get the Library to Delete
$Library = Get-PnPList -Identity $LibraryName -ErrorAction SilentlyContinue
 
#Check if Library exists
If($Library)
{
    #Allow Deletion
    $Library.AllowDeletion = $True
    $Library.Update()
    Invoke-PnPQuery
 
    #delete library in sharepoint online powershell
    Remove-PnPList -Identity $LibraryName -Recycle -Force
    Write-host -f Green "Library '$LibraryName' Deleted Successfully!"
}
Else
{
    Write-host -f Yellow "Could not find Library '$LibraryName'"
}

En este artículo, analizamos cómo eliminar una biblioteca de entrega en SharePoint Online. Si sigue los pasos descritos en esta guía, puede eliminar rápida y fácilmente una biblioteca de entrega para reducir el desorden en su entorno de SharePoint Online.

También en SharePoint local, puede eliminar cualquier biblioteca o lista de documentos configurando: "Permitir eliminación" en "Verdadero" como en mi otro artículo: ¿Cómo eliminar cualquier biblioteca o lista de documentos en SharePoint usando PowerShell?

Artículos relacionados