已重定向至Outlook日历,尽管生成了正确的Outlook日历项目URL



我正在为用户开发Flask仪表板。在一个专栏中,我列出了他们按日期降序存储的前10个日历约会。我希望事件的名称成为outlook.com中事件的链接。为了实现这一点,我使用了图形api返回的每个事件的id属性,并将其用作Jinja模板中的变量,因此它看起来有点像

{% if data['events']  %}
<ol style="text-decoration:none;">
{% for event in data['events']['value']%}
<li style="margin-bottom: 1em;" > 
<b><u><a href="https://outlook.office.com/calendar/item/{{event.id}}">{{ event.subject}}</a></u></b>
<p style='margin:0%;'>This is an event organized by <b>{{event.organizer['emailAddress'].name }}</b> that takes
place on <b>{{event.start['dateTime'].split('T')[0]}}</b></p>. The location provided is {{event.location['displayName'].strip(' ')}}
</li>

我正在进行的Graph调用看起来像:

# use a query parameter to get the top 10 results from the users calendar, sort by date descending
graph_data['events'] = microsoft.get('me/events?$orderby=end/dateTime%20desc').data

问题是,每次我点击其中一个链接时,我都会重定向到https://outlook.office.com/calendar/view/week。这正常吗?有办法绕过这个吗?任何帮助都将不胜感激,因为我是图形API和API开发的新手。

谢谢!

您需要将event.id编码为URL编码格式。

然后您应该能够在登录后打开活动。

最新更新