我正在开发一个Spring应用程序,我希望在其中集成OneDrive功能。不幸的是,我无法找到一些SDK,我可以使用一个for应用程序。Maven存储库中的一些内容将有所帮助。有人能告诉我如何为OneDrive认证和使用一些库吗?
难道我没有任何可以直接放在POM.xml中的SDK吗?就像谷歌、dropbox和其他很多服务一样。
以下是我尝试过的一些链接:
上面的示例都是针对android的,没有任何内容涉及到webapp。谢谢。
发布于 2021-02-16 10:22:02
在将近五年之后,我想补充一下,有一个Java图形,它也将涵盖您的OneDrive访问:https://github.com/microsoftgraph/msgraph-sdk-java
也许你已经解决了你的问题,但仅供参考。将此添加到POM中:
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>2.7.1</version>
</dependency>例如,您可以像这样在OneDrive中获取所有文件:
Builder2 clientBuilder = GraphServiceClient.builder()
.authenticationProvider(_accessTokenAuthProvider);
IHttpProvider httpProvider = DefaultClientConfig
.createWithAuthenticationProvider(_accessTokenAuthProvider)
.getHttpProvider(createOkHttpClientBuilder().build());
clientBuilder.httpProvider(httpProvider);
IGraphServiceClient graphServiceClient = clientBuilder.buildClient();
IDriveItemCollectionPage collectionPage = graphServiceClient.me().drive().root().children().buildRequest()
.select("Id,Name,Folder,Size").get();在上面的代码片段中,您需要添加实现AuthenticationProvider的IAuthenticationProvider, ICoreAuthenticationProvider。在执行时,您将得到collectionPage,它将包含一个DriveItems列表。
希望这对其他人有帮助。
发布于 2016-03-22 09:08:47
我不认为微软有一个用于网络应用的OneDrive SDK。但是,您可以很容易地使用他们的Rest来完成所有的工作。其余的API是非常直接的。https://dev.onedrive.com/README.htm
他们也有控制台来尝试那些api https://apigee.com/OneDrive/embed/console/OneDrive。
https://stackoverflow.com/questions/36132199
复制相似问题