2015-01-20 44 views

回答

0

使用CalendarEvent类的setDescription()方法。

Google Documentation - setDescription

下面是一些代码:

function setCalenderDescription() { 
    // Gets the public calendar "US Holidays" by ID. 
    var calendar = CalendarApp.getCalendarById(
    'en.usa#[email protected]'); 
    Logger.log('The calendar is named "%s".', calendar.getName()); 

    // Creates an event for the moon landing and logs the ID. 
    var event = calendar 
    .createEvent('Apollo 11 Landing', 
     new Date('July 20, 1969 20:00:00 UTC'), 
     new Date('July 20, 1969 21:00:00 UTC'), 
     {location: 'The Moon'}); 
    Logger.log('Event ID: ' + event.getId()); 

    //Set the description 
    event.setDescription("Das ist die neue Beschreibung"); 
}; 

如果你想代码从一个事件触发运行,没有事件触发的谷歌日历:

Google Documentation - Available types of Triggers

+0

嘿,谢谢。 它是否工作,如果我使用日历资源(https://developers.google.com/admin-sdk/calendar-resource/)因此,我需要验证自己。但这有可能吗? (https://developers.google.com/admin-sdk/calendar-resource/auth) – dermont 2015-01-21 08:12:20

+0

如果您想要访问任何Google产品之外的日历,那么这就是SDK和OAuth的用处。在这种情况下,您必须编写您自己的用户界面,然后您仅限于您的界面可以执行的操作。如果它是HTML,那么很容易根据任何主要操作触发辅助操作。这是一个网站吗?智能手机应用程序?还是你想要决定使用什么? – 2015-01-21 15:47:03

+0

是的,我正在努力为现在收集我的选择并寻找如何攻击这个怪物。出于好奇,是否可以直接在Google Calender网站上添加一个借口?当我开设新的活动时,“借口在这里”已经在那里了? – dermont 2015-01-21 20:43:58