尝试阅读Microsoft Graph中的其他日历时出错500

时间:2018-02-05 02:02:08

标签: outlook calendar microsoft-graph

GET /me/events

将仅返回我的默认日历活动。

现在我正在尝试阅读其他日历。

首先我做了

GET /me/calendarGroups

返回

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('576552d5-3bc0-42a6-a53d-bfceb405db23')/calendarGroups",
    "value": [
        {
            "id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEGAACpTc-InBsuTYwTUBb_VIb4AAAAADtIAAA=",
            "name": "My Calendars",
            "classId": "0006f0b7-0000-0000-c000-000000000046",
            "changeKey": "JNChQOAsRUyoL3s3Zbm58QAAcAE="
        },
        {
            "id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEGAACpTc-InBsuTYwTUBb_VIb4AAAAADtKAAA=",
            "name": "Other Calendars",
            "classId": "0006f0b8-0000-0000-c000-000000000046",
            "changeKey": "qU3PyJwbLk2ME1AW/lSG+AAAAAA+NA=="
        },
        {
            "id": "AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEGAACpTc-InBsuTYwTUBb_VIb4AABE-YjrAAA=",
            "name": "People's Calendars",
            "classId": "0006f0b9-0000-0000-c000-000000000046",
            "changeKey": "qU3PyJwbLk2ME1AW/lSG+AAARRPfCw=="
        }
    ]
}

它显示我有3个正确的日历。

然后基于the List events doc,我想我应该使用

GET /me/calendars/{id}/events

所以我试过

GET /me/calendars/AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEGAACpTc-InBsuTYwTUBb_VIb4AAAAADtKAAA=/events

但是

会返回500错误
{
    "error": {
        "code": "ErrorInternalServerError",
        "message": "An internal server error occurred. The operation failed.",
        "innerError": {
            "request-id": "53480d49-a721-40f0-ae6c-a19b5aa2a907",
            "date": "2018-02-05T02:00:29"
        }
    }
}

1 个答案:

答案 0 :(得分:2)

id返回的/calendarGroups是群组的ID,而不是日历的ID。原型应如下所示:

/me/calendargroups/{group-id}/calendars/{calendar-id}/events

如果您致电/me/calendargroups/AAMkADBlZTUwNTkxLWVmODgtNDVhNC1iZjhlLTdjNjA1ODZlMDI5MgBGAAAAAACUbnk-iwQZRbXMgkfKtmYhBwCpTc-InBsuTYwTUBb_VIb4AAAAAAEGAACpTc-InBsuTYwTUBb_VIb4AAAAADtKAAA=/calendars,您应该返回该群组中的日历列表。