Microsoft graph api 使用Microsoft Graph API获取系列事件的修改发生率

Microsoft graph api 使用Microsoft Graph API获取系列事件的修改发生率,microsoft-graph-api,Microsoft Graph Api,我正在使用webhook API订阅日历事件更改: 这真的很有效。 当我创建一个重复事件时,我会得到类型:“seriesMaster”属性,这很有意义 但是,如果我删除或修改某个事件,我仍然会得到seriesMaster事件,而不是我修改的事件 以下是返回到我的webhook的资源: [ { subscriptionId: '12345-sub-id', subscriptionExpirationDateTime: '2018-02-15T01:28:52.836+00:00',

我正在使用webhook API订阅日历事件更改:

这真的很有效。 当我创建一个重复事件时,我会得到类型:“seriesMaster”属性,这很有意义

但是,如果我删除或修改某个事件,我仍然会得到seriesMaster事件,而不是我修改的事件

以下是返回到我的webhook的资源:

[ { subscriptionId: '12345-sub-id',
    subscriptionExpirationDateTime: '2018-02-15T01:28:52.836+00:00',
    changeType: 'updated',
    resource: 'Users/12345-user-id/Events/12345-event-id',
    resourceData:
     { '@odata.type': '#Microsoft.Graph.Event',
       '@odata.id': 'Users/12345-user-id/Events/12345-event-id',
       '@odata.etag': 'W/"12345-tag-id"',
       id: '12345-event-id' },
    clientState: 'subscription-identifier' } ]
获取事件id后,我们将获得序列主控:

{ '@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users(\'user@example.com\')/calendar/events/$entity',
  '@odata.etag': 'W/"12345-etag-val"',
  id: '12345-event-id',
  createdDateTime: '2018-02-14T21:20:47.7698185Z',
  lastModifiedDateTime: '2018-02-15T01:27:00.3099975Z',
  changeKey: '12345-etag-val',
  categories: [],
  originalStartTimeZone: 'Mountain Standard Time',
  originalEndTimeZone: 'Mountain Standard Time',
  iCalUId: '12345-icaluid',
  reminderMinutesBeforeStart: 15,
  isReminderOn: true,
  hasAttachments: false,
  subject: 'test 201802141420',
  bodyPreview: 'testing',
  importance: 'normal',
  sensitivity: 'normal',
  isAllDay: false,
  isCancelled: false,
  isOrganizer: false,
  responseRequested: true,
  seriesMasterId: null,
  showAs: 'tentative',
  type: 'seriesMaster',
  ...
}

那么,在这种情况下,如何获得事件的修改/删除事件?

这很棘手,没有真正的简单方法可以覆盖所有场景。这是因为实际存在的唯一项目是系列母版,所有引用都是从中派生出来的

基本上,您可以在事件上展开instances属性,但您必须提供开始和结束时间,以确定服务器将展开的范围


因此,如果您知道重复模式的开始日期和结束日期(假设存在结束日期)!,可以展开所有实例。然后,您必须将其与之前的情况进行比较,以确定哪个特定实例发生了更改。

其他问题是,甚至不清楚seriesMaster或某个事件是否发生了更改。
{ '@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users(\'user@example.com\')/calendar/events/$entity',
  '@odata.etag': 'W/"12345-etag-val"',
  id: '12345-event-id',
  createdDateTime: '2018-02-14T21:20:47.7698185Z',
  lastModifiedDateTime: '2018-02-15T01:27:00.3099975Z',
  changeKey: '12345-etag-val',
  categories: [],
  originalStartTimeZone: 'Mountain Standard Time',
  originalEndTimeZone: 'Mountain Standard Time',
  iCalUId: '12345-icaluid',
  reminderMinutesBeforeStart: 15,
  isReminderOn: true,
  hasAttachments: false,
  subject: 'test 201802141420',
  bodyPreview: 'testing',
  importance: 'normal',
  sensitivity: 'normal',
  isAllDay: false,
  isCancelled: false,
  isOrganizer: false,
  responseRequested: true,
  seriesMasterId: null,
  showAs: 'tentative',
  type: 'seriesMaster',
  ...
}