Our main requirements were that the client should be compatible with OneDrive and OneDrive for Business, it should be easy to use, and shouldn’t have heavy dependencies. Keeping this in mind, we started developing a Java Client Library for OneDrive & OneDrive for Business REST APIs with basic features using Java 8 and only one light dependency
Check it out and feel free to submit your pull requests before it’s released!
Here’s how you can get ready to use this client.
OneDriveAPI api = new OneDriveBasicAPI("YOUR_ACCESS_TOKEN");
And for OneDrive for Business:
OneDriveAPI api = new OneDriveBusinessAPI("YOUR_RESOURCE_URL", "YOUR_ACCESS_TOKEN");
Now you are ready to fetch the metadata of any item, such as the root folder:
OneDriveFolder root = OneDriveFolder.getRoot(api);
OneDriveFolder.Metadata rootMetadata = root.getMetadata();
or any regular item:
OneDriveFile file = new OneDriveFile(api, "ITEM_ID");
OneDriveFile.Metadata fileMetadata = file.getMetadata();
Several features are available in this client, such as: Access to the children in the folder Download the file content Get ThumbnailSet Get email of current user, etc.
You can find detailed information here.
The Java client will be released in a few weeks! We’ll also provide a JS file picker for both OneDrive and OneDrive for Business over the REST API. Stay tuned for the release and more updates!