문제

I can't delete version range e.g. from VersionLabel=200 to VersionLabel=220. When I run powershell command it just deletes every second version (220, 222, 224 etc). Anyone know why it can't delete every version I want to delete?

...setting $versionsToDelete and

foreach($versionToDelete in $versionsToDelete){
    try {                
        Write-Host "Version $($versionToDelete.VersionLabel) created $($versionToDelete.Created) by $($versionToDelete.CreatedBy) will be removed"
        $versionToDelete.delete()
    } catch {
        Write-Error $_
    }
}
도움이 되었습니까?

해결책 2

Solved. The problem is that SharePoint after removing version e.g. version 220 moves all versions after version 220 and recalculates VersionId. After remove version I have to read again item and item's versions and remove next version e.g. 221.

다른 팁

you can try following approach may be it help

  1. Goto Version settings of the list

    and select version type Create major and minor (draft) versions Example: 1.0, 1.1, 1.2, 2.0

  2. Set Require Check Out Yes

Go to the list item -> checkin the document and override the document checkin. Then try to delete the document and rollback you changes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top