How to scan the workarea and delete old versions of content in TS, just keep latest 5 versions?
Remove old editions. Then run iwfsshrink.
If that is not sufficient you can use iwrlog to get the version IDs. May be able to remove the versions with the version ID>
I've tried using api of teamsite, but if I delete the previous version then an exception will be retruned.
Exceptionbject being looked up was not found
And I found through TeamSite UI, there is no way to delete previous version.
Any idears? Thanks.
Unless something has changed in the last several years.... The only way to delete past versions of files is to delete all the editions in which the specific version(s) of the file(s) exist - and making sure that the specific version(s) of the file(s) do not exist in any workarea or staging area. This may, however, also delete other version(s) of other file(s) that also only happened to exist within those editions that you delete.
Be careful when deleting editions though, as the actual process of performing the deletion may take more time than you realize - you can track the process by running iwstat -c - to make sure that each edition is fully deleted before deleting the next one (actually, edition deletion may not be that bad, I cannot remember off-hand; branch deletion is a very heavy weight process though)
Running iwfsshrink after completing the deletion of all the desired editions, as Nipper suggested, is probably a good idea too - but that runs in the background anyway so shouldn't be a significant issue in the overall scheme of things for your users.