-
-
Notifications
You must be signed in to change notification settings - Fork 370
Expand file tree
/
Copy pathupdate_plan_details.py
More file actions
34 lines (26 loc) · 1.1 KB
/
Copy pathupdate_plan_details.py
File metadata and controls
34 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Update planner plan details (category descriptions, sharing).
Category descriptions label the 25 color categories available for tasks
in the plan (e.g. category1 → "Urgent", category2 → "Client work").
Requires delegated permission ``Group.ReadWrite.All``.
https://learn.microsoft.com/en-us/graph/api/planner-update-plandetails?view=graph-rest-1.0
"""
import sys
from office365.graph_client import GraphClient
from tests import 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)
group = client.groups.get_by_name("My Sample Team").get().execute_query()
plans = group.planner.plans.get().execute_query()
if len(plans) == 0:
sys.exit("No plans were found")
plan = plans[0]
details = plan.details.get().execute_query()
details.set_property(
"categoryDescriptions",
{
"category1": "Urgent",
"category2": "Client work",
"category3": "Internal",
},
).update().execute_query()
print("Plan details updated — categories set: Urgent, Client work, Internal")