Versionshistorie in Sharepoint steuern
In diesem Video zeigt euch Thomas, wie ihr mit den Version History Limits in SharePoint Online die Anzahl von Dokumentenversionen reduziert und damit Storage spart – per GUI und PowerShell.
Benötigst du Unterstützung?
Melde dich bei uns!
Get-ExpiringAppCredentials.ps1
# Modul installieren oder aktualisieren
Install-Module Microsoft.Online.SharePoint.PowerShell -Force
Update-Module Microsoft.Online.SharePoint.PowerShell -Force
# Hinweis: Das SharePoint-Modul funktioniert nicht nativ in PowerShell 7.
# Am besten Windows PowerShell 5.1 (ISE oder blaues Fenster) verwenden.
Import-Module Microsoft.Online.SharePoint.PowerShell
# Verbinden
Connect-SPOService -Url https://EUER-TENANT-admin.sharepoint.com
# Aktuelle Tenant-Einstellungen prüfen
Get-SPOTenant | Select-Object EnableAutoExpirationVersionTrim, MajorVersionLimit, ExpireVersionsAfterDays
# Tenant-Level: Automatic Version History Limits aktivieren
Set-SPOTenant -EnableAutoExpirationVersionTrim $true
# Bestehende Libraries auf einer Site nachziehen
Set-SPOSite -Identity https://EUER-TENANT.sharepoint.com/sites/SITENAME -EnableAutoExpirationVersionTrim $true -ApplyToExistingDocumentLibraries
# Bestehende Libraries auf allen SharePoint-Sites nachziehen (OneDrive-Sites sind hier nicht enthalten)
Get-SPOSite -Limit All | ForEach-Object {
Set-SPOSite -Identity $_.Url -EnableAutoExpirationVersionTrim $true -ApplyToExistingDocumentLibraries
}
# Alte Versionen trimmen (ACHTUNG: dauerhaft gelöscht, kein Papierkorb!)
New-SPOSiteFileVersionBatchDeleteJob -Identity https://EUER-TENANT.sharepoint.com/sites/SITENAME -Automatic
# Trim-Job Status prüfen
Get-SPOSiteFileVersionBatchDeleteJobProgress -Identity https://EUER-TENANT.sharepoint.com/sites/SITENAME
# Trim-Job abbrechen
Remove-SPOSiteFileVersionBatchDeleteJob -Identity https://EUER-TENANT.sharepoint.com/sites/SITENAME