-
-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy pathcreate_notebook.py
More file actions
20 lines (17 loc) · 651 Bytes
/
create_notebook.py
File metadata and controls
20 lines (17 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""
Demonstrates how to create a new OneNote notebook
https://learn.microsoft.com/en-us/graph/api/resources/onenote
https://learn.microsoft.com/en-us/graph/api/onenote-post-notebooks?view=graph-rest-1.0
"""
from office365.graph_client import GraphClient
from tests import (
create_unique_name,
test_client_id,
test_password,
test_tenant,
test_username,
)
client = GraphClient(tenant=test_tenant).with_username_and_password(test_client_id, test_username, test_password)
display_name = create_unique_name("My Private notebook")
notebook = client.me.onenote.notebooks.add(display_name).execute_query()
print(notebook.display_name)