我有一个Java应用程序,它使用Microsoft Graph API发送邮件和安排事件。我能够使用以下格式的JSON创建发布请求的事件:
{
"subject": "Test event",
"start": {
"dateTime": "2017-12-01T09:00:00",
"timeZone": "SA Western Standard Time"
},
"end": {
"dateTime": "2017-12-01T10:00:00",
"timeZone": "SA Western Standard Time"
},
"body": {
"contentType": "TEXT",
"content": "This is a test"
},
"attendees": [{
"emailAddress": {
"address": "someuser@somewhere.com",
"name": "someuser"
}
}]
}
这将于12月1日上午9:00至10:00创建一个事件。当活动持续一天时,这就足够了。但现在我需要创建一个多日期事件,发生在12-01-2017和12-02-2017,两个日期从上午9:00到晚上10:00。所以我的问题是,创建此事件所需的JSON表示是什么?
答案 0 :(得分:2)
您需要为活动设置recurrence pattern:
"recurrence": {
"pattern": {
"type": "daily",
"interval": 1
},
"range": {
"type": "endDate",
"startDate": "2017-12-01",
"endDate": "2017-12-01"
}
}
完整的有效载荷如下所示:
{
"subject": "Test event",
"start": {
"dateTime": "2017-12-01T09:00:00",
"timeZone": "SA Western Standard Time"
},
"end": {
"dateTime": "2017-12-01T10:00:00",
"timeZone": "SA Western Standard Time"
},
"body": {
"contentType": "TEXT",
"content": "This is a test"
},
"attendees": [{
"emailAddress": {
"address": "someuser@somewhere.com",
"name": "someuser"
}
}],
"recurrence": {
"pattern": {
"type": "daily",
"interval": 1
},
"range": {
"type": "endDate",
"startDate": "2017-12-01",
"endDate": "2017-12-01"
}
}
}