I'm looking for a way to retry and if needed remove all documents located inside the tree of a given folder root with all of their versions, not just the current one.
The easiest way might be a SQL query with a batch deletion. Since previous version of a document are not filed in a Folder, I proceeded to do it this way:
- Perform a SELECT request on Document class
- Add a left join between a document version (Document as doc) and other versions (Document as doc2) using version_series key.
- Filter to get only current version from other versions (doc2.IsCurrentVersion = true)
- Filder to get only documents whose current version is filed in a given Folder tree (INSUBFOLDER clause)
Additional step:
- Left joins with ReferentialContainmentRelationShip and Folder classes to get the Path Name of the document current version Folder
The final request looks like below:
SELECT doc.this, doc.majorversionnumber AS "MAJV", doc.minorversionnumber AS "MINV", doc.IsCurrentVersion as "Is Current", doc2.This as "Current version", f.pathname As "Current version folder"FROM ((Document doc LEFT JOIN Document doc2 ON doc2.VersionSeries = doc.VersionSeries) LEFT JOIN ReferentialContainmentRelationShip rcr ON doc2.VersionSeries = rcr.VersionSeries)LEFT JOIN Folder f on f.This = rcr.tailWHERE doc2.IsCurrentVersion = true AND doc2.this INSUBFOLDER '/path/to/folder'/'ORDER BY doc2.ThisIs a good and not overkill way to achive what the goal?
#FileNet#Support#SupportMigration