如何以编程方式将事件添加到Outlook日历或Google日历?

Noa*_*tin 6 java outlook calendar web-applications google-calendar-api

我有一个Java Web应用程序,用户可以从中添加包含日期,主题和描述(如任务)的事件.我想以编程方式将这些事件发送到用户的Outlook日历.谁能帮助我如何实现这一目标?

PS:如果可以通过Google日历完成,请告诉我如何做到这一点,因为我没有坚持使用Outlook :)

Ga *_*chi 7

您现在可以使用Outlook Calendar REST API并从您的Java代码发送请求.

有关auth流程,请参阅此入门文档.

例如.发布到https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/发布 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"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)


Alb*_*che 5

Google 日历似乎是最佳选择,因为您可以使用 Google Calendar API。有关用 Java 编写的示例,请查看此处。请务必注意GCal API 使用限制

Outlook 似乎没有某种 API,但也许您可以使用或修改类似Jpstjava-libpst 之