You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -31,7 +33,7 @@ Add the dependency in `dependencies` in pom.xml
31
33
<dependency>
32
34
<groupId>com.microsoft.graph</groupId>
33
35
<artifactId>microsoft-graph</artifactId>
34
-
<version>2.10.0</version>
36
+
<version>3.0.0</version>
35
37
</dependency>
36
38
```
37
39
@@ -49,14 +51,14 @@ Register your application by following the steps at [Register your app with the
49
51
50
52
An instance of the **GraphServiceClient** class handles building requests, sending them to the Microsoft Graph API, and processing the responses. To create a new instance of this class, you need to provide an instance of `IAuthenticationProvider`, which can authenticate requests to Microsoft Graph.
51
53
52
-
For an example of authentication in a Java desktop client or server application, see the [Preview msgraph-sdk-java-auth](https://github.com/microsoftgraph/msgraph-sdk-java-auth) and for an Android application see [Preview msgraph-sdk-android-auth](https://github.com/microsoftgraph/msgraph-sdk-android-auth).
54
+
For an example of how to get an authentication provider, see [choose a Microsoft Graph authentication provider](https://docs.microsoft.com/graph/sdks/choose-authentication-providers?tabs=Java).
53
55
54
56
### 2.3 Get a GraphServiceClient object
55
57
56
58
After you have set the correct application ID and URL, you must get a **GraphServiceClient** object to make requests against the service. The SDK stores the account information for you, but when a user signs in for the first time, it invokes the UI to get the user's account information.
57
59
58
60
```java
59
-
IGraphServiceClient graphClient =
61
+
GraphServiceClient graphClient =
60
62
GraphServiceClient
61
63
.builder()
62
64
.authenticationProvider(authenticationProvider)
@@ -71,18 +73,25 @@ After you have a GraphServiceClient that is authenticated, you can begin making
71
73
72
74
To retrieve the user's drive:
73
75
76
+
```java
77
+
finalDrive result = graphClient
78
+
.me()
79
+
.drive()
80
+
.buildRequest()
81
+
.get();
82
+
System.out.println("Found Drive "+ result.id);
83
+
```
84
+
85
+
Or with the asynchronous API.
86
+
74
87
```java
75
88
graphClient
76
89
.me()
77
90
.drive()
78
91
.buildRequest()
79
-
.get(newICallback<Drive>() {
80
-
@Override
81
-
publicvoidsuccess(finalDriveresult) {
82
-
System.out.println("Found Drive "+ result.id);
83
-
}
84
-
...
85
-
// Handle failure case
92
+
.futureGet()
93
+
.thenApply(result -> {
94
+
System.out.println("Found Drive "+ result.id);
86
95
});
87
96
```
88
97
@@ -106,7 +115,9 @@ The Microsoft Graph SDK is open for contribution. To contribute to this project,
106
115
107
116
## 7. Supported Java versions
108
117
109
-
The Microsoft Graph SDK for Java library is supported at runtime for Java 7+ and [Android API revision 15](http://source.android.com/source/build-numbers.html) and greater.
118
+
The Microsoft Graph SDK for Java library is supported at runtime for Java 8+ and [Android API revision 26](http://source.android.com/source/build-numbers.html) and greater.
119
+
120
+
Android developers targeting lower android API levels can do so by [enabling desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) in their project.
110
121
111
122
## 8. License
112
123
@@ -115,11 +126,3 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the [MI
0 commit comments