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
Copy file name to clipboardExpand all lines: docs/upgrade-to-v6.md
+40-11Lines changed: 40 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,41 @@
1
-
# Microsoft Graph Java SDK v6 Changelog and Upgrade Guide
1
+
# Microsoft Graph Java SDK v6 Changelog and Upgrade Guide
2
2
3
3
This document provides a list of changes and upgrade considerations for the Microsoft Graph Java SDK v6 release.
4
4
5
-
## Overview
5
+
## Overview
6
6
7
7
Version 6.0.0 of the Microsoft Graph Java SDK is based on the new [Kiota](https://github.com/microsoft/kiota) code generation tool. By using Kiota the SDK is now able to support a broader range of Microsoft Graph API enpoints while also being more intuitive. Furthermore, [Graph-Core](https://github.com/microsoftgraph/msgraph-sdk-java-core) has also been updated to v3 which provides a great amount of added functionality; this makes v6 of the SDK a significant upgrade from v5.
8
8
9
+
## Table Of Contents
10
+
11
+
-[Breaking Changes](#breaking-changes)
12
+
-[Namespace Changes and Disambiguation](#namespace-changes-and-disambiguation)
13
+
-[Authentication](#authentication)
14
+
-[`BaseRequest<T>` Changed to `RequestInformation`](#use-of-requestinformation-in-place-of-baserequestt)
15
+
-[Removal of `Async` Suffix](#removal-of-async-suffix-from-executor-methods)
16
+
-[Removal of `buildRequest`](#removal-of-buildrequest)
17
+
-[`CollectionPage` Changed to `CollectionResponse`](#collectionpage-types-changed-to-collectionresponse-types)
-[Support for OData Casts](#support-for-odata-casts)
37
+
38
+
9
39
## Breaking Changes
10
40
11
41
The following is a list of breaking changes that users upgrading will want to consider while upgrading to v6 of the SDK.
@@ -20,7 +50,7 @@ This has the following implications:
20
50
- Models types are now stored in `com.microsoft.graph.models`/`com.microsoft.graph.beta.models` for v1.0 and beta respectively.
21
51
- RequestBuilder and RequestBody types reside in namespaces relative to the path they are calling. e.g. The `SendMailRequestBuilder` and `SendMailPostRequestBody` types will reside in the `com.microsoft.graph.users.item.sendmail`/`com.microsoft.graph.beta.users.item.sendMail` namespace if you are sending mail via `graphClient.me().sendMail().post(sendMailPostRequestBody)`.
22
52
23
-
### Authentication
53
+
### Authentication
24
54
25
55
The `GraphServiceClient` class now accepts an instance of `TokenCredential` from AzureIdentity directly rather than an instance of `TokenCredentialAuthProvider`.
The sdk no longer provides async methods for executing requests thus the async suffix has removed from executor methods. `postAsync()` is removed and now only `post()` is available, `getAsync()` is removed and only `get()`is available, etc.
86
116
> If users wish to execute requests asynchronusly they may choose to wrap their calls in CompleteableFutures or a separate async workflow.
87
117
88
-
### Removal of `buildRequest()`
118
+
### Removal of `buildRequest()`
89
119
90
120
In the previous version of the SDK the `buildRequest()` method call was neccessary when building and calling requests.
91
121
Previously a call to get the current user would look like the following:
@@ -109,7 +139,7 @@ In v6 the same call would return:
### Change in Indexing via ImprovedFluentAPIPattern
172
+
### Change in Indexing via ImprovedFluentAPIPattern
143
173
144
174
The fluent API pattern has changed slightly in v6. Previously the fluent API pattern would index into a collection through an overload method call in the request builder pattern. In v6 we have added the `byId` suffix to make it obvious when a user is indexing into a collection.
145
175
For example, retrieving a message by id would look like the following in v5:
The `Option` class has been removed and is no longer used to define query parameters, headers, or function parameters. These classes have been replaced with more specific and intuitive implementations.
157
187
158
-
#### Headers
188
+
#### Headers
159
189
Passing headers to requests has changed in v6. The `HeaderOption` class, which extends the `Option` class, has been removed and is no longer used to define headers.
160
190
Previously a user would pass headers to a request as follows:
`GraphServiceException` has been removed and is no longer used to handle errors. Instead, the SDK now throws an `ApiException` when an issue occurs with a request. The message of the `ApiException` will contain a more specific error message based on the OdataError returned from the API. `ClientException` remains, however, this is now used to handle less frequent issues with the client itself.
// See note above for using 'root' as the 'Item Id'
286
316
```
287
317
288
-
####Upload a SmallFile with conflictBehavior Set
318
+
### Upload a SmallFile with conflictBehavior Set
289
319
290
320
To upload a small file (size should not exceed 4mb according to the [docs](https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http)) and set the `conflictBehavior` [instance attribute](https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0#instance-attributes) you'll need to do it this way:
291
321
@@ -350,7 +380,7 @@ PageIterator<Message, MessageCollectionResponse> pageIterator = new PageIterator
350
380
pageIterator.iterate();
351
381
```
352
382
353
-
### BatchRequests
383
+
### BatchRequests
354
384
355
385
TheJavaSDK now supports Batch requests. Batching allows a user to send multiple requests in a single HTTP request which can improve performance and reduce network traffic. A user can chose to add a `RequestInformation` instance or an OkHttp3 `Request` instance to the Batch which will then be sent to the API as a single HTTP request. See here for more information on [batching](https://learn.microsoft.com/en-us/graph/json-batching).
356
386
```java
@@ -446,7 +476,6 @@ try{
446
476
// If your application encounters a connection interruption or a 5.x.x HTTP status during upload, you can resume the upload.
0 commit comments