msgraph-sdk-java icon indicating copy to clipboard operation
msgraph-sdk-java copied to clipboard

OneNote ContentRequestBuilder does not support the includeIDs query parameter

Open aaronanderson opened this issue 1 year ago • 1 comments

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 ```
</details>


### Configuration

_No response_

### Other information

_No response_

aaronanderson avatar Sep 21 '24 19:09 aaronanderson

@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();

Ndiritu avatar Sep 23 '24 13:09 Ndiritu