I'm trying to get my files on OneDrive using special SDK for Java.
https://github.com/OfficeDev/Office-365-SDK-for-Java
There are 2 examples in this library to post file and then get it by ID, but what about getting list of files to work with? I tried Files and Drive resources with executing read and get operation, but there are errors.
What I try to do:
JavaDependencyResolver javaDependencyResolver = new .
JavaDependencyResolver(token.getAccessToken());
GraphServiceClient client = new
GraphServiceClient("https://graph.microsoft.com/v1.0", javaDependencyResolver);
client.getUsers().getById(idToken.getObjectId()).getFiles().readRaw().get()
The error I get:
com.microsoft.services.orc.core.OrcException: Response status: 400
Response content: {
"error": {
"code": "BadRequest",
"message": "Unsupported segment type. ODataQuery: users('{ID}')/files",
"innerError": {
"request-id": "4a8da651-03ee-4ca3-b17f-75460c3b09d6",
"date": "2017-07-11T12:27:25"
}
}
}
Does this library provide functionality to iterate through files? What the API should be used to achieve that?
This library is not currently supported by Microsoft. I would recommend using the Microsoft Graph library for this.
You can query files like this:
graph.getMe().getDrive().getItems().buildRequest().get();