如何通过 Outlook 365 Rest 添加循环日历事件 Api?

How to add a recurring calendar event through Outlook 365 Rest Api?

我正在使用 PHP 访问 Outlook 365 REST API。我通过 POST 将以下有效负载发送到 https://outlook.office.com/api/v2.0/me/events,并在 return 中收到 500 错误。我的负载是如何配置错误的?

{
    "Subject":"Test Event",
    "Location": { 
        "DisplayName":"Test Location"
        },
    "Start": {
        "DateTime":"2016-09-06T00:00:00Z",
        "TimeZone":"UTC"
        },
    "End":{
        "DateTime":"2016-09-06T02:00:00Z",
        "TimeZone":"UTC"
        },
    "Body":{
        "ContentType":"HTML",
        "Content":"Stephen Colbert"
        },
    "Recurrence":{
        "Pattern":{
            "Month":0,
            "DayOfMonth":0,
            "FirstDayOfWeek":"Sunday",
            "Index":"First",
            "Type":"Daily"
            },
        "Range":{
            "NumberOfOccurrences":0,
            "Type":"EndDate",
            "EndDate":"2016-09-09",
            "StartDate":"2016-09-05",
            "RecurrenceTimeZone":"Eastern Standard Time"
            }
        }
}

您想如何创建周期性事件?如果您想每天使用该模式创建会议,我们还需要使用 Interval 来指定给定重复类型的单位数。

这里有一个演示创建从 2016-09-05 到 2016-09-09 每天发生的定期会议的示例:

{
"Subject":"Test Event",
"Location": { 
    "DisplayName":"Test Location"
    },
"Start": {
    "DateTime":"2016-09-06T00:00:00Z",
    "TimeZone":"UTC"
    },
"End":{
    "DateTime":"2016-09-06T02:00:00Z",
    "TimeZone":"UTC"
    },
"Body":{
    "ContentType":"HTML",
    "Content":"Stephen Colbert"
    },
"Recurrence":{
    "Pattern":{
       "Interval":1,
        "Type":"Daily"
        },
    "Range":{
        "NumberOfOccurrences":5,
        "Type":"EndDate",
        "EndDate":"2016-09-09",
        "StartDate":"2016-09-05",
        "RecurrenceTimeZone":"Eastern Standard Time"
        }
    }

}

并且您可以考虑使用 Outlook UI 创建经常性事件以帮助理解 RecurrencePattern 参数。 here 是一个类似的线程供您参考。