How to get the Version Number of the Previous File Versions?
回答済みI am able to get the current version Number of a file, but the previous version number i am unable to find a way to get that. Please help me on this
-
You can use the Get Versions endpoint to get information about previous versions of a file.
-
BoxFile file = new BoxFile(userApi, "xxxxxx"); System.out.println("file current version: " + file.getInfo().getVersion().getVersionID()); Collection versions = file.getVersions(); // Fetching the Previous Version of the Files int versionIndex = versions.size(); if (versions.size() != 0) { // If there is no Previous Versions for (BoxFileVersion bfv : versions) { if (versionIndex == versions.size()) // the first one is the previous version { bfv.promote(); bfv.delete(); System.out.println("Deleted Version ID : "+ bfv.getVersionID()); } System.out.println("bfv: [" + versionIndex-- + "] " + bfv.getVersionID() + " " + bfv.getCreatedAt()); } }
サインインしてコメントを残してください。
コメント
4件のコメント