-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Page in OneNote using Java SDK v6.x #2083
Comments
Thanks for reaching out @DMarf. The snippet you have is the best we can support now since we're not currently generating query parameters for POST requests. From a high level check, the SDK writes the value of the OnenotePage content field to a stream directly. Would you mind clarifying what you mean by the serialization approach being invalid? |
Thank you for following up @Ndiritu When I enable okhttp logging it shows my post with the following body: The okhttp logging shows the following response to that post from the server: I can confirm that my page content does contain the boundary. I have been able to work around the problem using the following code with the same content that fails above as follows:
With this code the okhttp logging shows my content being sent directly in the body of the post rather then being included in the "content" field of a serialized version of OnennotePage and my content successfully appears in OneNote. Is this the proper way the SDK is meant to be used? By the approach being invalid, I meant that I wasn't sure if a page could be uploaded in the manner I expected. The SDK posts something else (the serialized page) versus what is required by the server (the page contents directly). |
Thank you for clarifying @DMarf. Yes, this points to an issue in the SDK. Glad you were able to find a workaround. |
My current app successfully creates pages in OneNote using the Java SDK 5.x. I am looking to update to the latest Java SDK 6.x (in the process of also adding support for OneDrive).
I have read through the Microsoft Graph Java SDK v6 Changelog and Upgrade Guide and am obtaining valid tokens. I can't find, however, any documentation or examples of how to create a page in OneNote using the Java SDK 6.x. The article Create onenotePage provides examples for HTTP, CLI, and JavaScript, but is missing the examples for C#, Go, Java, etc. provided for other actions such as Create notebook.
Is it possible to create pages using the Java SDK 6.x? Are there any examples?
I have tried the Kotlin code below in the absence of documentation, but always receive the error "The multi-part payload was malformed". Debugging by enabling okhttp logging leads me to believe that this approach results in posting a serialized version of the OnenotePage object rather than the contents field as required. (I didn't provide my initialization for 'contents' as the whole approach seems invalid.)
The text was updated successfully, but these errors were encountered: