在Office 365 api中插入周期性事件会返回不正确的开始日期和结束日期 [英] Insert recurring event on office 365 api returns incorrect start and end date
问题描述
我正在开发基于Microsoft Office 365 Api的Asp.net MVC App日历。
当我尝试插入一个事件服务器时,会更改我的开始日期和结束日期。
我在Microsoft Graph Api Explorer中尝试过:
根据邮件正文,第一场比赛应该是1月1日的第一个周一,即2017年1月1日。由于原始开始日期和结束日期(4/7/2016)不符合此模式,服务器会自动将其更改为1/2/2017 hh:mm:ss。
您可能需要更改重复以符合业务要求。
I'm developing an Asp.net MVC App calendar, based on microsoft Office 365 Api. When I'm trying to insert an event server changes my start date and end date.
I've tried on Microsoft Graph Api Explorer here: https://graph.microsoft.io/en-us/graph-explorer, with this event:
{
"subject": "TEST 11",
"recurrence": {
"pattern": {
"type": "relativeYearly",
"interval": 1,
"month": 1,
"dayOfMonth": 0,
"daysOfWeek": [
"monday"
],
"firstDayOfWeek": "sunday",
"index": "first"
},
"range": {
"type": "noEnd",
"startDate": "2016-04-07",
"endDate": "0001-01-01",
"recurrenceTimeZone": "UTC",
"numberOfOccurrences": 0
}
},
"body": {
"content": ""
},
"end": {
"dateTime": "2016-04-07T13:30:00",
"timeZone": "UTC"
},
"start": {
"dateTime": "2016-04-07T12:00:00",
"timeZone": "UTC"
}
}
and I can't figure out why it returns me this result:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('fb28a0fc-d439-46c1-b501-aa436c81b089')/events/$entity",
"@odata.etag": "W/\"+OqDZnLqWUiJHsDJY80iMwAAydKXaA==\"",
"id": "AAMkADVlYTFhYTI3LTdkYzQtNDgwMS05ZGRmLTExYjI3YjRmM2U1NwBGAAAAAACXbg5biElkTKzIlWuGxBCkBwD46oNmcupZSIkewMljzSIzAAAAAAENAAD46oNmcupZSIkewMljzSIzAADJymunAAA=",
"createdDateTime": "2016-04-07T12:29:19.9539087Z",
"lastModifiedDateTime": "2016-04-07T12:29:19.9695341Z",
"changeKey": "+OqDZnLqWUiJHsDJY80iMwAAydKXaA==",
"categories": [],
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"iCalUId": "040000008200E00074C5B7101A82E008000000008F87CA1BC990D101000000000000000010000000DA81E77A153D2945A59DB6B7C9134881",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "TEST 11",
"body": {
"contentType": "text",
"content": ""
},
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"start": {
"dateTime": "2017-01-02T12:00:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2017-01-02T13:30:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"address": {}
},
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"recurrence": {
"pattern": {
"type": "relativeYearly",
"interval": 1,
"month": 1,
"dayOfMonth": 0,
"daysOfWeek": [
"monday"
],
"firstDayOfWeek": "sunday",
"index": "first"
},
"range": {
"type": "noEnd",
"startDate": "2017-01-02",
"endDate": "0001-01-01",
"recurrenceTimeZone": "UTC",
"numberOfOccurrences": 0
}
},
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "seriesMaster",
"attendees": [],
"organizer": {
"emailAddress": {
"name": "Luigi Gallo",
"address": "luigi.gallo@uniroma3.it"
}
},
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADVlYTFhYTI3LTdkYzQtNDgwMS05ZGRmLTExYjI3YjRmM2U1NwBGAAAAAACXbg5biElkTKzIlWuGxBCkBwD46oNmcupZSIkewMljzSIzAAAAAAENAAD46oNmcupZSIkewMljzSIzAADJymunAAA%3D&exvsurl=1&viewmodel=ICalendarItemDetailsViewModelFactory"
}
"month": 1,
"daysOfWeek": [
"monday"
],
"firstDayOfWeek": "sunday",
"index": "first"
What kind of recurring event did you want to insert? Based on the code, you were inserting an "relativeYearly" event like the figure below:
According to the post body, the first match should be the first Monday of January which is 1/2/2017. Since the original start date and end date(4/7/2016) does not match this pattern, the server automatically change it to 1/2/2017 hh:mm:ss.
You may need to change the recurrence to fit the business requirement.
这篇关于在Office 365 api中插入周期性事件会返回不正确的开始日期和结束日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!