microsoftgraph / microsoftgraph/msgraph-sdk-java
Create Page in OneNote using Java SDK v6.x
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 444
- Forks
- 154
- Avg merge
- 18h 28m
- Merged PRs (30d)
- 4
Description
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.)
val mypage = OnenotePage()
mypage.content = content
mGraphClient!!.me().onenote()
.pages()
.withUrl("https://graph.microsoft.com/v1.0/me/onenote/pages?sectionName=MySection")
.post(mypage) { requestConfiguration ->
requestConfiguration.headers.add(
"content-type",
"multipart/form-data; boundary=MyBoundary1234"
)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Microsoft Graph Java SDK v6 Upgrade Guide and the OneNote create-page article linked in the issue, then compare the available Java SDK request patterns with the existing HTTP and JavaScript examples. Confirm the supported multipart request shape and document a working Java 6.x example, including the expected request content and a clear completion check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100