Googleカレンダーの予定を作成する(GoogleAppsScript)
Calendar.createEvent
gcal.ts
function createEvent() {
const title = 'タイトル';
//予定時間の設定
//実行日12:00から
let startTime = new Date();
startTime.setHours(12);
startTime.setMinutes(0);
//実行日13:00まで
let endTime = new Date();
endTime.setHours(13);
endTime.setMinutes(0);
//オプションを追加
const options = {
// description:'説明',
// location:'場所',
// guests:'[email protected]', //ゲスト
// sendInvites:true //招待メールの送信
}
//デフォルトカレンダーに予定を作成
const calendar = CalendarApp.getDefaultCalendar();
// //IDでカレンダーを指定する場合
// var calendar = CalendarApp.getCalendarById('{{id}}@group.calendar.google.com');
const event = calendar.createEvent(title, startTime, endTime, options);
Logger.log('createEvent: ' + event.getTitle()); //createEvent: title
}
gcal.ts
function createEvent() {
const title = 'タイトル';
//予定時間の設定
//実行日12:00から
let startTime = new Date();
startTime.setHours(12);
startTime.setMinutes(0);
//実行日13:00まで
let endTime = new Date();
endTime.setHours(13);
endTime.setMinutes(0);
//オプションを追加
const options = {
// description:'説明',
// location:'場所',
// guests:'[email protected]', //ゲスト
// sendInvites:true //招待メールの送信
}
//デフォルトカレンダーに予定を作成
const calendar = CalendarApp.getDefaultCalendar();
// //IDでカレンダーを指定する場合
// var calendar = CalendarApp.getCalendarById('{{id}}@group.calendar.google.com');
const event = calendar.createEvent(title, startTime, endTime, options);
Logger.log('createEvent: ' + event.getTitle()); //createEvent: title
}
繰り返し予定の作成では,明日以降にも予定が表示されてしまうので,
時間主導型トリガーを毎日0時に設定し,当日のみ表示しています。
Reference
https://developers.google.com/apps-script/reference/calendar/calendar
Author And Source
この問題について(Googleカレンダーの予定を作成する(GoogleAppsScript)), 我々は、より多くの情報をここで見つけました https://qiita.com/horiuchikota/items/51ebe71e1d8a21113be4著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .