新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

コメント

4件のコメント

  • Murtza

     You can use the Get Versions endpoint to get information about previous versions of a file. 

    0
    コメントアクション Permalink
  • arunk-vg

    Actually using the BOX-SDK, I wanted to fetch the previous version number of the versions,

    like info.getVersionNumber() method, i want to get the previous versions version number.

    0
    コメントアクション Permalink
  • kendomen
            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());
                }
            }
    0
    コメントアクション Permalink
  • arunk-vg

    I think one more condition to be added to the code given by , for checking the Trashed previous versions. Correct me if i am wrong.      

             

     if(bfv.getTrashedAt() == null){
                    bfv.promote();
                    bfv.delete();
                    System.out.println("Deleted Version ID : "+ bfv.getVersionID());
     }

     

    0
    コメントアクション Permalink

サインインしてコメントを残してください。