如何从Microsoft Graph API获取事件主题和内容?

2024-04-18 12:33:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我向/users/{id}/calendar/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}发送GET请求以获取用户的事件,然后过滤事件主题和内容。 在大多数情况下,JSON响应中的主题只是事件组织者的名称,内容只是一个空白的HTML,而不是通常可以在日历中看到的值。你知道吗

我试图在JSON中找到另一个可以提供正确信息的字段,但是没有。 看起来有些人也有同样的问题(herehere),但没有找到解决方案,或者给出的不是我需要的。你知道吗

我使用的代码如下:

graph_client = OAuth2Session(token=token)

headers = {
  'Prefer' : 'outlook.timezone="America/Manaus"'
}

response = graph_client.get(f'{self.graph_url}/users/{room}/calendar/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}',
                                 headers=headers)

print(response.json()['value'])

Tags: json内容主题datetimehere事件startusers