1

“在日历组中创建日历”Outlook API 端点最近(在过去几周内)在我目前正在处理的多租户应用程序中停止工作。

下面是使用 Python shell 重现问题:

import api

>>> url = "https://outlook.office.com/api/v2.0/users/auser@adomain.com/calendargroups"
>>> response = api.get(url)
>>> response
[{
    u'ClassId': u'bf22395d-e505-4f58-8504-6e6e8ef8c3c7', 
    u'Name': u'My Calendar Group', 
    u'ChangeKey': u'g4QAQQ9PZUGX1I2OsM9/LgAAA0km+g==', 
    u'@odata.id': u"https://outlook.office.com/api/v2.0/Users('46560569-3535-441e-9bcf-eb093a992360@767316c0-7a9b-4a7c-95e9-5490466be3f0')/CalendarGroups('AAMkAGVmNzJkNGNiLWE4YmYtNDQ2NC1iOGJiLWI5ZmFlYzgyNzVmYgBGAAAAAAC3biJFdLv_S7D_aGLbIKWwBwCDhABBD09lQZfUjU6wz38uAAAAAAEGAACDhABBD09lQZfUjU6wz38uAAADSL12AAA=')", 
    u'Id': u'AAMkAGVmNzJkNGNiLWE4YmYtNDQ2NC1iOGJiLWI5ZmFlYzgyNzVmYgBGAAAAAAC3biJFdLv_S7D_aGLbIKWwBwCDhABBD09lQZfUjU6wz38uAAAAAAEGAACDhABBD09lQZfUjU6wz38uAAADSL12AAA='
}]


>>> calendargroup_id = response[0]['Id']
>>> url += "/%s/calendars" % calendargroup_id
>>> url
"https://outlook.office.com/api/v2.0/users/auser@adomain.com/calendargroups/AAMkAGVmNzJkNGNiLWE4YmYtNDQ2NC1iOGJiLWI5ZmFlYzgyNzVmYgBGAAAAAAC3biJFdLv_S7D_aGLbIKWwBwCDhABBD09lQZfUjU6wz38uAAAAAAEGAACDhABBD09lQZfUjU6wz38uAAADSL12AAA=/calendars"

>>> api.get(url) // This API call succeeds. It successfully tells us that this calendargroup contains no calendars. In other words it is able to identify the calendargroup using the calendargroup_id we send it.
[]

>>> api.post(url, data={'Name': 'New Calendar'}) // This is the failing API call. If we try to do a POST request in order to create a new calendar, the API can no longer parse our id, and complains:
{u'error': {u'message': u'Id is malformed.', u'code': u'ErrorInvalidIdMalformed'}}

我已确认此错误发生在 Microsoft Graph 和 Outlook API 端点上。

我认为这可能与在 API 端点上进行的 base64 解码类型有关,因为我能够通过在其中一个 id 中用 '+' 替换所有 '_' 实例来使 API 工作。如果 id 包含“-”字符,则此解决方法不起作用,在这种情况下,我找不到解决该错误的方法。

我们正在使用许多其他端点来创建事件、日历组和订阅,并且它们都可以正常工作。只有这个端点给我们带来了问题。

有关如何解决此错误的任何想法?

4

0 回答 0