简体   繁体   English

如何通过Outlook 365 Rest Api添加定期日历事件?

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

I am using PHP to access the Outlook 365 REST API. 我正在使用PHP访问Outlook 365 REST API。 I am sending following payload via POST to https://outlook.office.com/api/v2.0/me/events and receiving a 500 error in return. 我正在通过POST将以下有效负载发送到https://outlook.office.com/api/v2.0/me/events并收到500错误的回报。 How is my payload misconfigured? 有效载荷如何配置错误?

{
    "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"
            }
        }
}

How did you want to create the recurrent event? 您想如何创建周期性事件? If you want to create the meeting using the pattern daily, we also need use Interval to specify the number of units of a given recurrence type between occurrences. 如果要每天使用模式创建会议,我们还需要使用“ 间隔”来指定两次出现之间给定重复类型的单位数。

Here is an example that demo to create the recurrent meeting occurring everyday from 2016-09-05 to 2016-09-09: 这是一个示例,演示如何创建从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"
        }
    }

} }

And you may consider to use the Outlook UI for creating recurrent event to help understanding the RecurrencePattern paramter. 并且您可能考虑使用Outlook UI创建重复事件,以帮助理解RecurrencePattern参数。 And here is a similar thread for your reference. 这里有一个类似的线程供您参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM