Microsoft Graph增量:重复发生的日历事件返回了错误的开始/结束

时间:2018-06-27 22:21:45

标签: microsoft-graph

我有一个应用程序,可以将日历项目加载到数据库中,并且需要与给定用户的日历保持同步。不幸的是,当使用Delta令牌查询给定日期范围的Microsoft Graph时,将返回原始事件的数据。但是,如果从查询中删除了Delta调用,则会按预期返回重复发生的事件。

没有Delta的呼叫

https://graph.microsoft.com/v1.0/me/calendarView?startDateTime=2018-06-26T00:00:00&endDateTime=2018-06-27T00:00:00&$select=id,subject,start,end

返回:

    {
        "@odata.etag": "W/\"vDPrV1TQYUmam8nxPycXGwABJbtmSQ==\"",
        "id": "AAMkADZhMjA2YTNmLTM0NDktNDYyNy05Njk2LTRjNThhMDZkZDBmOQFRAAgI1dr3wqKAAEYAAAAAY_l4isQ6OkOWdkEvK3rrDQcAvDPrV1TQYUmam8nxPycXGwAAAAABDQAAvDPrV1TQYUmam8nxPycXGwAAAtcOVAAAEA==",
        "subject": "Daily recurring event",
        "start": {
            "dateTime": "2018-06-26T14:30:00.0000000",
            "timeZone": "UTC"
        },
        "end": {
            "dateTime": "2018-06-26T14:45:00.0000000",
            "timeZone": "UTC"
        }
    }

但是,当尝试使用相同的开始/结束日期将“ delta”调用添加到请求中时,将返回事件的原始日期(和ID)。此外,SELECT列将被完全忽略。

与Delta通话:

https://graph.microsoft.com/v1.0/me/calendarView/delta?startDateTime=2018-06-26T00:00:00&endDateTime=2018-06-27T00:00:00&$select=id,subject,start,end

返回:

    {
        "@odata.type": "#microsoft.graph.event",
        "@odata.etag": "W/\"vDPrV1TQYUmam8nxPycXGwABJbtmSQ==\"",
        "createdDateTime": "2017-04-19T15:02:38.8680605Z",
        "lastModifiedDateTime": "2018-06-25T14:15:14.2194888Z",
        "changeKey": "vDPrV1TQYUmam8nxPycXGwABJbtmSQ==",
        "categories": [],
        "originalStartTimeZone": "Eastern Standard Time",
        "originalEndTimeZone": "Eastern Standard Time",
        "iCalUId": "040000008200E00074C5B7101A82E0080000000050B9E76D2CF2D001000000000000000010000000831C6E0657580F44A0799E55EB5F2E49",
        "reminderMinutesBeforeStart": 15,
        "isReminderOn": true,
        "hasAttachments": false,
        "subject": "Daily recurring event",
        "bodyPreview": "",
        "importance": "normal",
        "sensitivity": "normal",
        "isAllDay": false,
        "isCancelled": false,
        "isOrganizer": false,
        "responseRequested": true,
        "seriesMasterId": null,
        "showAs": "busy",
        "type": "seriesMaster",
        ...
        "id": "AAMkADZhMjA2YTNmLTM0NDktNDYyNy05Njk2LTRjNThhMDZkZDBmOQBGAAAAAABj6XiKxDo6Q5Z2QS8reusNBwC8M_tXVNBhSZqbyfE-JxcbAAAAAAENAAC8M_tXVNBhSZqbyfE-JxcbAAAC1w5UAAA=",
        "responseStatus": {
            "response": "accepted",
            "time": "2017-04-19T15:02:00Z"
        },
        "body": {
            "contentType": "html",
            "content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta name=\"Generator\" content=\"Microsoft Exchange Server\">\r\n<!-- converted from rtf -->\r\n<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>\r\n</head>\r\n<body>\r\n<font face=\"Calibri\" size=\"2\"><span style=\"font-size:11pt;\">\r\n<div>&nbsp;</div>\r\n<div>&nbsp;</div>\r\n</span></font>\r\n</body>\r\n</html>\r\n"
        },
        "start": {
            "dateTime": "2015-09-22T14:30:00.0000000",
            "timeZone": "UTC"
        },
        "end": {
            "dateTime": "2015-09-22T14:45:00.0000000",
            "timeZone": "UTC"
        },
        "location": {
            "displayName": "on your feet",
            "locationType": "default",
            "uniqueId": "on your feet",
            "uniqueIdType": "private"
        },
        "locations": [
            {
                "displayName": "on your feet",
                "locationType": "default",
                "uniqueId": "on your feet",
                "uniqueIdType": "private"
            }
        ],
        "recurrence": {
            "pattern": {
                "type": "weekly",
                "interval": 1,
                "month": 0,
                "dayOfMonth": 0,
                "daysOfWeek": [
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday"
                ],
                "firstDayOfWeek": "sunday",
                "index": "first"
            },
            "range": {
                "type": "noEnd",
                "startDate": "2015-09-22",
                "endDate": "0001-01-01",
                "recurrenceTimeZone": "Eastern Standard Time",
                "numberOfOccurrences": 0
            }
        },
        "attendees": [
            {
                "type": "required",
                "status": {
                    "response": "none",
                    "time": "0001-01-01T00:00:00Z"
                },
                "emailAddress": {
                    "name": "Nunya Biz",
                    "address": "biz@markie.com"
                }
            }
        ],
        "organizer": {
            "emailAddress": {
                "name": "Nunya Biz",
                "address": "biz@markie.com"
            }
        }
    },

有人可以告诉我如何获取Delta查询以返回重复事件的实例,而不是“ seriesMaster”吗?

1 个答案:

答案 0 :(得分:0)

啊,我知道了!增量返回seriesMaster,但最后还返回实例详细信息(发生)。我不好将它排除在原始帖子的结果之外。

缺少的链接:

    {
        "@odata.type": "#microsoft.graph.event",
        "@odata.etag": "W/\"DwAAABYAAAC8M+tXVNBhSZqbyfE/JxcbAAElu2ZJ\"",
        "seriesMasterId": "AAMkADZhMjA2YTNmLTM0NDktNDYyNy05Njk2LTRjNThhMDZkZDBmOQBGAAAAAABj6XiKxDo6Q5Z2QS8reusNBwC8M_tXVNBhSZqbyfE-JxcbAAAAAAENAAC8M_tXVNBhSZqbyfE-JxcbAAAC1w5UAAA=",
        "type": "occurrence",
        "id": "AAMkADZhMjA2YTNmLTM0NDktNDYyNy05Njk2LTRjNThhMDZkZDBmOQFRAAgI1dr3wqKAAEYAAAAAY_l4isQ6OkOWdkEvK3rrDQcAvDPrV1TQYUmam8nxPycXGwAAAAABDQAAvDPrV1TQYUmam8nxPycXGwAAAtcOVAAAEA==",
        "start": {
            "dateTime": "2018-06-26T14:30:00.0000000",
            "timeZone": "UTC"
        },
        "end": {
            "dateTime": "2018-06-26T14:45:00.0000000",
            "timeZone": "UTC"
        }
    },

请注意,“ type” =“ occurrence”,并且“ seriesMasterId”指向seriesMaster的Id字段。其中包含事件的正确开始/结束信息。