microsoftgraph / microsoftgraph/msgraph-sdk-java

Create Page in OneNote using Java SDK v6.x

Aperta
#2,083 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

area:serialization type:bug
Lingua principale
Java
Stelle
444
Fork
154
Merge medio
18h 28m
PR unite (30g)
4

Descrizione

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"
        )
    }

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il Microsoft Graph Java SDK v6 Upgrade Guide e l’articolo OneNote create-page collegato nell’issue, quindi confronta i pattern di richiesta disponibili del Java SDK con gli esempi HTTP e JavaScript esistenti. Conferma la forma di richiesta multipart supportata e documenta un esempio Java 6.x funzionante, incluso il contenuto previsto della richiesta e un controllo chiaro del completamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api, documentation
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.