microsoftgraph / microsoftgraph/msgraph-sdk-java
Create Page in OneNote using Java SDK v6.x
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 444
- Forks
- 154
- Ø Merge
- 18 Std. 28 Min.
- Gemergte PRs (30 T.)
- 4
Beschreibung
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"
)
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Microsoft Graph Java SDK v6 Upgrade Guide und dem im Issue verlinkten OneNote create-page-Artikel. Vergleichen Sie anschließend die verfügbaren Anforderungsmuster des Java SDK mit den vorhandenen HTTP- und JavaScript-Beispielen. Bestätigen Sie die unterstützte Form der Multipart-Anforderung und dokumentieren Sie ein funktionierendes Java-6.x-Beispiel einschließlich des erwarteten Anforderungsinhalts und einer eindeutigen Prüfung auf den Abschluss.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- api, documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100