box-apiboxboxapiv2

How to get the version number of the file using BOX-SDK?


BoxFileVersion CLASS doesn't seem to have a method to get the name of the version ("V1", "V2" etc).

I can see that BoxFile.Info has a getVersionNumber() method but this just returns a null.


Solution

  • BoxFile.Info.getVersionNumber() will give you the version number, but this attribute is not populated by default - it's listed in italics in Box API docs.

    Optional attributes need to be requested explicitly, e.g. by calling BoxFile.getInfo(fields) with "version_number" in fields array.