versionning
2 TopicsPowerShell script to configure the List versionning before execute the migration to SP Online
When you are in a migration project from SharePoint On Premise to SharePoint Online, the worst case is the SPList in which is the User decided to implement versionning without any limitation. You can have thousand of versions to migrate into only one list which will require many hours to migrate, generally without any added value for the Users because they never realized that setting was set. The Migration does not like that because it will be so long to execute that site migration. In my case, i have a site in which the size used by with only 2 items (execl file less than 1MB) of one list was more than 400MB. So that first will delete all the versions before the XX last ones: function Delete-Version-History([string]$SPWebURL, [string]$SPListName, [int]$MaintainVersionNumber) { [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null Write-Host " -------------------------------------------------------- " Write-Host "SPWeb URL to configure:", $SPWebURL -foregroundcolor Red $site = new-object Microsoft.SharePoint.SPSite($SPWebURL) $web = $site.openweb() Write-Host " >> SPWeb URL from Object:", $web.URL -foregroundcolor Green $SPlist = $web.Lists[$SPListName] Write-Host " >> SPList to Configure:", $SPlist.Title -foregroundcolor Green Write-Host " >> Total Item to check:", $SPlist.Items.Count -foregroundcolor Green foreach ($SPitem in $SPlist.Items) { Write-Host " >>>>>> File Item:", $SPitem.Name, "- Version Total:", $SPItem.Versions.count -foregroundcolor Magenta $currentVersionsCount = $SPItem.Versions.count if($currentVersionsCount -gt $MaintainVersionNumber) { for($i=$currentVersionsCount-1; $i -gt $MaintainVersionNumber; $i--) { $SPItem.versions[$i].delete() Write-Host " >>>>>> Version:", $i, " Deleted" $SPlist.Update(); } } } $web.Dispose(); $site.Dispose(); } cls Delete-Version-History http://MyWebApplication/sites/MySPSite/MySPWeb "My List Name" 50 This case is cool, but sometime, it could be better to directly apply the Versionning and force the list to apply this settings immediatly, so that other script will be used to: function Configure-Versionning-SPList([string]$SPWebURL, [string]$SPListName, [int]$MaintainMajorVersionNumber, [bool]$EnableMinorVersionYesNo, [int]$MaintainMinorVersionNumber) { [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null Write-Host " -------------------------------------------------------- " Write-Host "SPWeb URL to configure:", $SPWebURL -foregroundcolor Red $site = new-object Microsoft.SharePoint.SPSite($SPWebURL) $web = $site.openweb() Write-Host " >> SPWeb URL from Object:", $web.URL -foregroundcolor Green $SPlist = $web.Lists[$SPListName] Write-Host " >> SPList to Configure:", $SPlist.Title -foregroundcolor Green if($SPlist.EnableVersioning -eq $true) { $SPlist.MajorVersionLimit = $MaintainMajorVersionNumber; if($EnableMinorVersionYesNo -eq $true) { $SPlist.EnableMinorVersions = $EnableMinorVersionYesNo $SPlist.MajorWithMinorVersionsLimit = $MaintainMinorVersionNumber; } } else { $SPlist.EnableVersioning = $True $SPlist.MajorVersionLimit = $MaintainMajorVersionNumber; if($EnableMinorVersionYesNo -eq $true) { $SPlist.EnableMinorVersions = $EnableMinorVersionYesNo $SPlist.MajorWithMinorVersionsLimit = $MaintainMinorVersionNumber; } } $SPlist.Update(); $web.Dispose(); $site.Dispose(); } function Force-Apply-Versionning-OnItems([string]$SPWebURL, [string]$SPListName, [int]$MaintainVersionNumber) { [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null Write-Host " -------------------------------------------------------- " Write-Host "SPWeb URL to configure:", $SPWebURL -foregroundcolor Red $site = new-object Microsoft.SharePoint.SPSite($SPWebURL) $web = $site.openweb() Write-Host " >> SPWeb URL from Object:", $web.URL -foregroundcolor Green $SPlist = $web.Lists[$SPListName] Write-Host " >> SPList to Configure:", $SPlist.Title -foregroundcolor Green Write-Host " >> Total Item to check:", $SPlist.Items.Count -foregroundcolor Green foreach ($SPitem in $SPlist.Items) { Write-Host " >>>>>> File Item:", $SPitem.Name, "- Version Total:", $SPItem.Versions.count -foregroundcolor Magenta $currentVersionsCount = $SPItem.Versions.count if($currentVersionsCount -gt $MaintainVersionNumber) { $SPitem.SystemUpdate() } } $SPlist.Update(); $web.Dispose(); $site.Dispose(); } Configure-Versionning-SPList http://MyWebApplication/sites/MySPSite/MySPWeb "My List Name" 50 $false 0 Force-Apply-Versionning-OnItems http://MyWebApplication/sites/MySPSite/MySPWeb "My List Name" 50 Any choice you selected, the only objective is to reduce as much as possible the time required to migrate the content. Romelard Fabrice [MVP] Source: http://salaudeen.blogspot.co.uk/2011/01/limitcleanup-versioning-in-sharepoint.html https://social.technet.microsoft.com/Forums/ie/en-US/53694860-2a7c-4bfb-ba1f-3b8b17c031b9/sharepoint-2007-document-library-deleting-all-versions-in-bulk?forum=sharepointadminlegacy http://crashcarr.com/22/22 http://www.sharepointdiary.com/2011/01/limit-versioning-and-delete-old-versions-in-sharepoint.html#ixzz4pAZ0epuO French version: http://blogs.developpeur.org/fabrice69/archive/2017/08/08/office-365-nettoyage-des-versions-de-list-item-avant-migration-depuis-sharepoint-on-premise-vers-sharepoint-online.aspx1.6KViews0likes0CommentsLatest thinking displaying SharePoint version number in a Word document
This seems to very unreliable or unpredictable. [Many years ago, I think it used to work fine - I sued it]. There are various incantations out there involving the using {Version} or {_UIVersionString} in Information management policy settings (having enabled) it and using label from Quickparts. Some say you need to make a content type for the library, other don't think this is necessary. Some report that the whole feature is deprecated. So can it be done in the lates version of everything? (Please don't link me back to one of the many old articles describing a method unless you are using it an up to date environment and it works) At the moment I have some documents that sometimes work and sometimes don't with docuemtns in the same library using the same template behing differently - a randomness I hate - I cant even build a reliable truth table for what makes it work or not: it's like a table lamp with a loose flex, flickering on and off. I keep think there must be an easier way to do this - surely we can't be the only orgnaisation who wants the same version number as the user sees in SharePoint as a field in the footer or the Word document? Why doe sversion (the column that appears when you enable version control) simply not appear as a document property or a field in Word? (Is there a way to add it without lables? Although the option to control the document information panel in word seems to have gone.)1.3KViews2likes0Comments