microsoftgraph / microsoftgraph/msgraph-sdk-python
JSON serialization exception when creating PlannerTask
Open
@rkodev is already working on this.
Since Jul 12, 2024.
Needs: Attention :wave:
- Dominant language
- Python
- Stars
- 630
- Forks
- 96
- Avg merge
- 15h 20m
- Merged PRs (30d)
- 3
Description
Sample Python code from this documentation page does not work if any of datetime-typed fields initialized.
Exception with message Object of type DateTime is not JSON serializable is thrown.
Non-working code:
graph_client = GraphServiceClient(credentials, scopes)
request_body = PlannerTask(
plan_id = "xqQg5FS2LkCp935s-FIFm2QAFkHM",
bucket_id = "hsOf2dhOJkqyYYZEtdzDe2QAIUCR",
title = "Update client list",
assignments = PlannerAssignments(
additional_data = {
"fbab97d0-4932-4511-b675-204639209557" : {
"@odata_type" : "#microsoft.graph.plannerAssignment",
"order_hint" : " !",
},
}
),
due_date_time = datetime(2023, 12, 31)
)
result = await graph_client.planner.tasks.post(request_body)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.