Sample using the Java Graph SDK to push OneDrive content to OneNote using multipart POST
-
Register an app at apps.dev.microsoft.com
a) Copy-paste the application ID into the
Constants
file asclientId
b) Click "Generate New Password" to get an application secret
c) Copy-paste the application secret into the
Constants
file asclientSecret
d) Click "Add a Platform" > "Web" This console app will not have a UI, but this platform will be used during the admin consent in step 2
e) Set the redirect url to "http://localhost"
f) Under Application Permissions, select:
- Directory.ReadWrite.All - Group.ReadWrite.All - Notes.ReadWrite.All
g) Hit "Save"
-
Authorize your app to access the permissions you requested in your registration
a) Navigate to the URL:
https://login.microsoftonline.com/{tenant}/adminconsent
?client_id={client_id}
&state=12345
&redirect_uri=http://localhost
b) Log in as an administrator to approve the scopes you requested
-
Update the code to match your tenant
a) In
OnenoteSync
, update the group to search for to match a group in your tenant -
Build and run the console app
This sample uses the Java SDK for Microsoft Graph. You can learn more on the project's wiki.