microsoftgraph / msgraph-sdk-java

Microsoft Graph SDK for Java
https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
MIT License
372 stars 125 forks source link

OneNote ContentRequestBuilder does not support the includeIDs query parameter #2165

Open aaronanderson opened 5 days ago

aaronanderson commented 5 days ago

Describe the bug

The Graph API OneNote Get page API documentation indicates that the content endpoint supports an includeIDs parameter.

GET /me/onenote/pages/{id}/content[?includeIDs=true]

However, there is no way to set it using the Java SDK ContentRequestBuilder class.

Expected behavior

The Java SDK should support setting this query parameter so that IDs are embedded in the content that can be used in partial update requests.

How to reproduce

String pageId = "...";
OnenoteRequestBuilder requestBuilder = graphClient.me().onenote();

try (InputStream is = requestBuilder.pages().byOnenotePageId(pageId).content().get(r -> {
  //    r.queryParameters.includeIDs = true; 
})) {
    System.out.printf("\t\tContent %s\n", IOUtils.toString(is, Charset.defaultCharset()));
     } catch (IOException e) {
    e.printStackTrace();
}

SDK Version

6.16.0

Latest version known to work for scenario above?

No response

Known Workarounds

Use a different rest client (JAX-RS):

WebTarget base = client.target("https://graph.microsoft.com/v1.0/me/onenote");
Response response = base.path("/pages").path(pageId).path("content").queryParam("includeIDs", "true").request().get();
System.out.format("Page contents: %d %s\n", response.getStatus(), response.readEntity(String.class));

Debug output

Click to expand log ``` ```

Configuration

No response

Other information

No response

Ndiritu commented 3 days ago

@aaronanderson thank you for reaching out. To unblock this scenario, kindly use the withUrl method to override the request URL & pass the query parameter:

graphClient.me().onenote().pages().byOnenotePageId(pageId).content().withUrl(
    graphClient.getRequestAdapter().getBaseUrl() + "/me/onenote/pages/{id}/content[?includeIDs=true]"
).get();