我有一个 Java Web 应用程序,用户可以从中添加带有日期、主题和描述的事件(如任务)。我想以编程方式将这些事件发送到用户的 Outlook 日历。谁能帮我实现这个目标?
PS:如果可以通过 Google Calendar 完成,请告诉我该怎么做,因为我不会受困于 outlook :)
最佳答案
您现在可以使用 Outlook Calendar REST API并从您的 Java 代码发送请求。
有关授权流程,请参阅 this getting started documentation .
例如。发布到 https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/events一个 JSON 内容,例如:
{
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
"Start": {
"DateTime": "2014-02-02T18:00:00",
"TimeZone": "Pacific Standard Time"
},
"End": {
"DateTime": "2014-02-02T19:00:00",
"TimeZone": "Pacific Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "janets@a830edad9050849NDA1.onmicrosoft.com",
"Name": "Janet Schorr"
},
"Type": "Required"
}
]
}
关于java - 如何以编程方式将事件添加到 Outlook 日历或 Google 日历?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18694607/