빠른 시작에서는 Google Workspace API를 호출하는 앱을 설정하고 실행하는 방법을 설명합니다.
Google Workspace 빠른 시작에서는 API 클라이언트 라이브러리를 사용하여 인증 및 승인 흐름의 일부 세부정보를 처리합니다. 자체 앱에는 클라이언트 라이브러리를 사용하는 것이 좋습니다. 이 빠른 시작에서는 테스트 환경에 적합한 간소화된 인증 접근 방식을 사용합니다. 프로덕션 환경의 경우 앱에 적합한 액세스 사용자 인증 정보를 선택하기 전에 인증 및 승인에 관해 알아보는 것이 좋습니다.
/** * Lists 10 upcoming events in the user's calendar. * @see https://developers.google.com/calendar/api/v3/reference/events/list */functionlistUpcomingEvents(){constcalendarId='primary';// Add query parameters in optionalArgsconstoptionalArgs={timeMin:(newDate()).toISOString(),showDeleted:false,singleEvents:true,maxResults:10,orderBy:'startTime'// use other optional query parameter here as needed.};try{// call Events.list method to list the calendar events using calendarId optional query parameterconstresponse=Calendar.Events.list(calendarId,optionalArgs);constevents=response.items;if(events.length===0){console.log('Noupcomingeventsfound');return;}// Print the calendar eventsfor(consteventofevents){letwhen=event.start.dateTime;if(!when){when=event.start.date;}console.log('%s(%s)',event.summary,when);}}catch(err){// TODO (developer) - Handle exception from Calendar APIconsole.log('Failedwitherror%s',err.message);}}
[null,null,["최종 업데이트: 2024-12-21(UTC)"],[[["This quickstart demonstrates how to use Google Apps Script to access the Google Calendar API and list upcoming events."],["You will need a Google Account with Google Calendar and Drive enabled to complete this quickstart."],["The script utilizes the Calendar API client library and requires authorization to access your calendar data."],["After running the script, it will display the summaries and dates/times of your upcoming events in the execution log."],["For production environments, more robust authentication methods are recommended, and further resources are provided for advanced usage and troubleshooting."]]],[]]