Modifying single occurrence from recurring series is not reflected in the data read from the Rest API

人盡茶涼 提交于 2019-12-02 00:47:50

Exceptions and occurrences aren't actually exposed in the Recurrence object. In order to see individual occurrences or exceptions, you need to use the CalendarView endpoint. This causes Exchange to expand recurring events for the time window specified, and it returns individual occurrences or exceptions. This is necessary because the individual occurrences/exceptions do not exist on the calendar as actual events, they are derived from the series master. If you just do a GET on /Me/Events, you never see them!

For example, I created a recurring event on my calendar, then I modified one occurrence to be at a different time (which makes it an exception).

Doing a GET on /Me/Events:

{
  "@odata.context": "https://outlook.office365.com/api/v1.0/$metadata#Me/Events",
  "value": [
    {
      "@odata.id": "https://outlook.office365.com/api/v1.0/Users('jason@johnstonian.onmicrosoft.com')/Events('AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OABGAAAAAABp4MZ-5xP3TJnNAPmjsRslBwAoPBSqxXQOT6tuE0pxCMrtAAAAAAENAAAoPBSqxXQOT6tuE0pxCMrtAAC5xYC1AAA=')",
      "@odata.etag": "W/\"KDwUqsV0Dk+rbhNKcQjK7QAAucdOPw==\"",
      "Id": "AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OABGAAAAAABp4MZ-5xP3TJnNAPmjsRslBwAoPBSqxXQOT6tuE0pxCMrtAAAAAAENAAAoPBSqxXQOT6tuE0pxCMrtAAC5xYC1AAA=",
      "ChangeKey": "KDwUqsV0Dk+rbhNKcQjK7QAAucdOPw==",
      "Categories": [],
      "DateTimeCreated": "2015-05-28T13:39:06.310974Z",
      "DateTimeLastModified": "2015-05-28T13:39:21.0300106Z",
      "Subject": "Exception test",
      "BodyPreview": "​",
      "Body": {
        "ContentType": "HTML",
        "Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<style type=\"text/css\" style=\"display:none;\"><!-- P {margin-top:0;margin-bottom:0;} --></style>\r\n</head>\r\n<body dir=\"ltr\">\r\n<div id=\"divtagdefaultwrapper\" style=\"font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;\">\r\n<p>​<br>\r\n</p>\r\n</div>\r\n</body>\r\n</html>\r\n"
      },
      "Importance": "Normal",
      "HasAttachments": false,
      "Start": "2015-05-28T20:00:00Z",
      "StartTimeZone": "Eastern Standard Time",
      "End": "2015-05-28T20:30:00Z",
      "EndTimeZone": "Eastern Standard Time",
      "Reminder": 15,
      "Location": {
        "DisplayName": "My Office",
        "Address": {
          "Street": "",
          "City": "",
          "State": "",
          "CountryOrRegion": "",
          "PostalCode": ""
        },
        "Coordinates": {
          "Accuracy": "NaN",
          "Altitude": "NaN",
          "AltitudeAccuracy": "NaN",
          "Latitude": "NaN",
          "Longitude": "NaN"
        }
      },
      "ResponseStatus": {
        "Response": "Organizer",
        "Time": "0001-01-01T00:00:00Z"
      },
      "ShowAs": "Busy",
      "IsAllDay": false,
      "IsCancelled": false,
      "IsOrganizer": true,
      "ResponseRequested": true,
      "Type": "SeriesMaster",
      "SeriesMasterId": null,
      "Attendees": [],
      "Recurrence": {
        "Pattern": {
          "Type": "Daily",
          "Interval": 1,
          "Month": 0,
          "Index": "First",
          "FirstDayOfWeek": "Sunday",
          "DayOfMonth": 0
        },
        "Range": {
          "Type": "EndDate",
          "StartDate": "2015-05-28T00:00:00-04:00",
          "EndDate": "2015-06-04T00:00:00-04:00",
          "NumberOfOccurrences": 0
        }
      },
      "Organizer": {
        "EmailAddress": {
          "Address": "jason@johnstonian.onmicrosoft.com",
          "Name": "Jason Johnston"
        }
      },
      "iCalUId": "040000008200E00074C5B7101A82E008000000006CACEEAA4B99D0010000000000000000100000009478C61D36C90847B5F3C126ACB0A17E",
      "WebLink": "https://outlook.office365.com/owa/?ItemID=AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OABGAAAAAABp4MZ%2F5xP3TJnNAPmjsRslBwAoPBSqxXQOT6tuE0pxCMrtAAAAAAENAAAoPBSqxXQOT6tuE0pxCMrtAAC5xYC1AAA%3D&exvsurl=1&viewmodel=ICalendarItemDetailsViewModelFactory"
    }
  ]
}

Doing a GET on /Me/CalendarView for the day on which the exception falls (note the "Type": "Exception" field):

GET /Me/CalendarView?startDateTime=2015-05-30T04:00:00Z&endDateTime=2015-05-31T04:00:00Z

{
  "@odata.id": "https://outlook.office365.com/api/v1.0/Users('jason@johnstonian.onmicrosoft.com')/Events('AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OAFRAAgI0miCtL1AAEYAAAAAaeDGf_cT90yZzQD5o7EbJQcAKDwUqsV0Dk_rbhNKcQjK7QAAAAABDQAAKDwUqsV0Dk_rbhNKcQjK7QAAucWAtQAAEA==')",
  "@odata.etag": "W/\"KDwUqsV0Dk+rbhNKcQjK7QAAucdOPw==\"",
  "Id": "AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OAFRAAgI0miCtL1AAEYAAAAAaeDGf_cT90yZzQD5o7EbJQcAKDwUqsV0Dk_rbhNKcQjK7QAAAAABDQAAKDwUqsV0Dk_rbhNKcQjK7QAAucWAtQAAEA==",
  "ChangeKey": "KDwUqsV0Dk+rbhNKcQjK7QAAucdOPw==",
  "Categories": [],
  "DateTimeCreated": "2015-05-28T13:39:20.9676251Z",
  "DateTimeLastModified": "2015-05-28T13:39:20.9676252Z",
  "Subject": "Exception test",
  "BodyPreview": "​",
  "Body": {
    "ContentType": "HTML",
    "Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<style type=\"text/css\" style=\"display:none;\"><!-- P {margin-top:0;margin-bottom:0;} --></style>\r\n</head>\r\n<body dir=\"ltr\">\r\n<div id=\"divtagdefaultwrapper\" style=\"font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;\">\r\n<p>​<br>\r\n</p>\r\n</div>\r\n</body>\r\n</html>\r\n"
  },
  "Importance": "Normal",
  "HasAttachments": false,
  "Start": "2015-05-30T20:30:00Z",
  "StartTimeZone": "Eastern Standard Time",
  "End": "2015-05-30T21:00:00Z",
  "EndTimeZone": "Eastern Standard Time",
  "Reminder": 15,
  "Location": {
    "DisplayName": "My Office",
    "Address": {
      "Street": "",
      "City": "",
      "State": "",
      "CountryOrRegion": "",
      "PostalCode": ""
    },
    "Coordinates": {
      "Accuracy": "NaN",
      "Altitude": "NaN",
      "AltitudeAccuracy": "NaN",
      "Latitude": "NaN",
      "Longitude": "NaN"
    }
  },
  "ResponseStatus": {
    "Response": "Organizer",
    "Time": "0001-01-01T00:00:00Z"
  },
  "ShowAs": "Busy",
  "IsAllDay": false,
  "IsCancelled": false,
  "IsOrganizer": true,
  "ResponseRequested": true,
  "Type": "Exception",
  "SeriesMasterId": "AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OABGAAAAAABp4MZ-5xP3TJnNAPmjsRslBwAoPBSqxXQOT6tuE0pxCMrtAAAAAAENAAAoPBSqxXQOT6tuE0pxCMrtAAC5xYC1AAA=",
  "Attendees": [],
  "Recurrence": null,
  "Organizer": {
    "EmailAddress": {
      "Address": "jason@johnstonian.onmicrosoft.com",
      "Name": "Jason Johnston"
    }
  },
  "iCalUId": "040000008200E00074C5B7101A82E00807DF051E6CACEEAA4B99D0010000000000000000100000009478C61D36C90847B5F3C126ACB0A17E",
  "WebLink": "https://outlook.office365.com/owa/?ItemID=AAMkADRmMDExYzhjLWYyNGMtNDZmMC1iZDU4LTRkMjk4YTdjMjU5OAFRAAgI0miCtL1AAEYAAAAAaeDGf%2BcT90yZzQD5o7EbJQcAKDwUqsV0Dk%2BrbhNKcQjK7QAAAAABDQAAKDwUqsV0Dk%2BrbhNKcQjK7QAAucWAtQAAEA%3D%3D&exvsurl=1&viewmodel=ICalendarItemDetailsViewModelFactory"
}

Also, this is a great forum for reporting issues directly to us. As long as your tagging with outlook-restapi, we'll see it! :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!