异常和事件实际上并未在Recurrence
对象中公开。为了查看个别事件或例外情况,您需要使用CalendarView端点。这会导致 Exchange 为指定的时间窗口展开重复事件,并返回单个事件或异常。这是必要的,因为日历上的个别事件/例外不作为实际事件存在,它们是从系列主文件中派生的。如果你只是做一个 GET on /Me/Events
,你永远看不到它们!
例如,我在我的日历上创建了一个重复事件,然后我将一个事件修改为在不同的时间(这使它成为一个例外)。
做一个 GET /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"
}
]
}
/Me/CalendarView
在异常发生的那一天执行 GET (注意该"Type": "Exception"
字段):
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"
}
此外,这是一个直接向我们报告问题的绝佳论坛。只要你的标签outlook-restapi
,我们会看到它!:)