microsoftgraph / microsoftgraph/msgraph-sdk-java
Create Page in OneNote using Java SDK v6.x
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 444
- Forks
- 154
- Merge moyen
- 18 h 28 min
- PR mergées (30 j)
- 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"
)
}
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le Microsoft Graph Java SDK v6 Upgrade Guide et l’article OneNote create-page lié dans l’issue, puis comparez les modèles de requêtes disponibles du Java SDK avec les exemples HTTP et JavaScript existants. Confirmez la forme de requête multipart prise en charge et documentez un exemple Java 6.x fonctionnel, en incluant le contenu attendu de la requête et une vérification claire de l’achèvement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- api, documentation
- Type d'issue
- Documentation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100