【问题标题】:how to copy every new event in google calendar from this time to another calendar via API?如何通过API将此时谷歌日历中的每个新事件复制到另一个日历?
【发布时间】:2016-02-07 13:18:11
【问题描述】:

我想通过 API 将每个新事件(通常是递归事件)自动复制到另一个谷歌日历。

我试图用这段代码来做这件事,但它也复制了它们的日期在未来的旧事件。

    function copyEvents() {
  var calendarSource = CalendarApp.getCalendarById("calendarSourceId");
  var calendarDestination = CalendarApp.getCalendarById("calendarDestinationId");
  var eventToCopy = calendarSource.getEvents(new Date("February 6, 2016 EST"), new Date("July 22, 2100 EST"));


  for (var i in eventToCopy){
    var newEvent = calendarDestination.createEventSeries(eventToCopy[i].getTitle(), eventToCopy[i].getStartTime(), eventToCopy[i].getEndTime(), eventToCopy[i].getEventSeries());
  }
}

【问题讨论】:

    标签: google-apps-script google-api google-calendar-api


    【解决方案1】:

    您可以通过调用“Events.created”获取事件的创建时间,并使用“Events:move”将事件移动到另一个日历。 p>

    这是一个将事件移动到另一个日历的 HTTP 请求:POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId/move

    更多详情,请点击此链接:https://developers.google.com/google-apps/calendar/v3/reference/events/move

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多