在Google脚本中创建全天活动

时间:2013-11-16 21:59:02

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

我正在为一个拥有Outlook日历的组织工作,办公室的每个人都需要访问。我们开始切换到IPhones,并且能够让我们的用户访问该日历我正在通过谷歌日历分享这些活动,用户可以通过Iphone查看。但是,当与Outlook中的Google日历共享事件时,它会使事件从早上12点到早上12点,事件占用了整整一天,很难看到当天发生的其他事件。

我曾尝试编写一些谷歌脚本,将超过12小时的任何谷歌日历活动转换为“全天活动”,使活动仅显示在顶部。

我可以编写一个google脚本,其中包含以下内容:

如果超过12小时,则SETasALLdayEvent()???

请您就如何改进以下Google脚本提出建议?我非常感谢,谢谢!

function processInvites2() {
  var calendarId =  'examplecalendar@gmail.com'; // this needs to be the email address of the calendar you're monitoring
  var invited = "INVITED";
  var accepted = "YES";
  var accept = CalendarApp.GuestStatus.YES;
  var reject = CalendarApp.GuestStatus.NO;
  var rejection = "Eep - someone else has a booking then..."; //subject line for our email to reject a booking

  var calendar = CalendarApp.getCalendarById(calendarId);

  var start = new Date();
  var end = new Date("January 1, 2015 00:00:00 UTC");
  var invites = calendar.getEvents(start, end, invited); //find all future invites (up to 2099)

  for(var i = 0; i < invites.length; i++){



      invites[i].setMyStatus(accept);


  }
};

非常感谢你的帮助!!

1 个答案:

答案 0 :(得分:0)

是的,你可以写这样的脚本。看看calendarApp。

相关问题