OneDrive

You may already be familiar with the OneDrive and OneDrive for Business REST API. The latest API version was introduced in 2014, and Microsoft provides several clients, except Java.

With our goal to integrate external storage services such as Microsoft OneDrive, Google Drive, Dropbox or Box into the Nuxeo Platform, via the Live Connect addon, we needed a Java client.

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 minimal-json. 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.

Getting Started


Just keep it simple! Get your access token by following the OneDrive how to or the OneDrive for Business how to documents and you will be ready to use the Java client.

For OneDrive:

            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.

What's Next


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!