如何以编程方式将事件添加到Outlook日历或Google日历? [英] How to add events to Outlook Calendar or Google Calendar programmatically?

查看:251
本文介绍了如何以编程方式将事件添加到Outlook日历或Google日历?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a Java Web application from which the user can add events with date, subject and description (like tasks). I want to send these events to the user's outlook calendar programmatically. Can anyone help me how to achieve this?

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

PS: If it can be done through Google Calendar tell me how to do that as I am not stuck with outlook :)

推荐答案

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

You can now use Outlook Calendar REST API and send requests from your java code.

auth flow请参阅此入门文档

For the auth flow see this getting started documentation.

例如。发布到 https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/events 一个JSON内容,如:

Eg. POST to https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/events a JSON content like:

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

这篇关于如何以编程方式将事件添加到Outlook日历或Google日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆