0
캘린더에 google 스크립트를 사용하고 있으며 예제로 재생하려고합니다. 그러나 아래 코드를 실행하면 null이라는 메서드 "createEvent"를 호출 할 수 없다는 것을 계속합니다. 사실 나는 여기서 콜백 함수를 이해하지 못하고있다. 그래서 그것은 일반적인 js 질문이거나 google script 질문입니다.Google 스크립트 : null의 메소드를 호출 할 수 없습니다.
function createEvent() {
/*var cal = CalendarApp.getCalendarById(calendarId);*/
var cal = CalendarApp.getAllOwnedCalendars()[0];
var title = 'Script Demo Event';
var start = new Date("October 26, 2013 08:00:00 EST");
var end = new Date("October 26, 2013 10:00:00 EST");
var desc = 'Created using Google Apps Script';
var loc = 'Script Center';
var event = cal.createEvent(title, start, end, {
description : desc,
location : loc
});
};
function doGet() { // A script with a user interface that is published as a web app
// must contain a doGet(e) function.
// Create the UiInstance object myapp and set the title text
var myapp = UiApp.createApplication().setTitle('Here is the title bar');
// Create a button called mybutton and set the button text
var mybutton = myapp.createButton('Here is a button');
var handler = myapp.createServerHandler('createEventInvitePeople');
mybutton.addClickHandler(handler);
// Create a vertical panel called mypanel and add it to myapp
var mypanel = myapp.createVerticalPanel();
// Add mybutton to mypanel
mypanel.add(mybutton);
// Add my panel to myapp
myapp.add(mypanel);
// return myapp to display the UiInstance object and all elements associated with it.
return myapp;
}
/**
* Creates an event, invite guests, book rooms, and sends invitation emails.
* For more information on using Calendar events, see
* https://developers.google.com/apps-script/class_calendarevent.
*/
function createEventInvitePeople() {
var calId = CalendarApp.getAllOwnedCalendars()[0];
var room1CalId = 'a_room_cal_id';
var room2CalId = 'another_room_cal_id';
var guest1Email = '[email protected]';
var guest2Email = '[email protected]';
var invitees = room1CalId + ',' + room2CalId + ',' + guest1Email + ',' +
guest2Email;
var cal = CalendarApp.getCalendarById(calId);
var title = 'Script Center Demo Event';
var start = new Date("October 30, 2012 08:00:00 PDT");
var end = new Date("October 30, 2012 10:00:00 PDT");
var desc = 'Created using Apps Script';
var loc = 'Script Center';
var send = 'true';
var event = cal.createEvent(title, start, end, {
description : desc,
location : loc,
guests : invitees,
sendInvites : send
});
};
사람이 나에게 부탁을 수행 할 수 있습니다
var event = cal.createEvent(title, start, end, {
description : desc,
location : loc
});
};
여기에 전체 코드는?
앱 배포 방법, 오류 발생 시점, 어떤 사례를 참조 할 수 있습니까? –
위의 코드를 사용합니다. doGet() 함수를 실행하고 앱으로 배포합니다. – user2592038
이 설명을 읽었습니까? https://developers.google.com/apps-script/execution_web_apps? 웹 응용 프로그램에 사용할 옵션을 선택했으면 배포 버튼을 클릭합니다. 프로젝트가 웹 앱으로 성공적으로 배포되었다는 메시지와 함께 새로운 대화 상자가 나타납니다. 해당 메시지 아래에서 웹 응용 프로그램의 URL을 찾을 수 있습니다. 해당 URL을 복사하여 브라우저에서 웹 응용 프로그램에 액세스 할 때 사용하십시오. –