{"id":645,"date":"2019-01-18T08:00:00","date_gmt":"2019-01-17T23:00:00","guid":{"rendered":"http:\/\/google-apps-script.net\/instructions\/?p=645"},"modified":"2021-02-18T15:07:29","modified_gmt":"2021-02-18T06:07:29","slug":"how-to-use-oncalendar-change-triggers-for-gas","status":"publish","type":"post","link":"https:\/\/for-dummies.net\/gas-noobs\/how-to-use-oncalendar-change-triggers-for-gas\/","title":{"rendered":"\u3010GAS\u3011Google\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u767a\u52d5\u3059\u308b\u30c8\u30ea\u30ac\u30fc\u3092\u4f7f\u3044\u3053\u306a\u3059"},"content":{"rendered":"<h2>\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u767a\u52d5\u3059\u308b\u30ab\u30ec\u30f3\u30c0\u30fc\u30c8\u30ea\u30ac\u30fc<\/h2>\n<p>2018\u5e742\u670826\u65e5\u306eGoogle Apps Script\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u7de8\u96c6\u3092\u5f15\u304d\u91d1\u306b\u3001Google Apps Script\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u30c8\u30ea\u30ac\u30fc\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u7de8\u96c6\u6642\u306b\u7de8\u96c6\u3057\u305f\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b\u305e\uff01\u3068\u559c\u3093\u3067\u3044\u305f\u79c1\u3067\u3059\u304c\u3001GAS\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u95a2\u9023\u306e\u51e6\u7406\u3092\u884c\u3046\u57fa\u790e\u7684\u306aCalendarApp\u3067\u306f\u3042\u307e\u308a\u5927\u3057\u305f\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u306a\u3044\u3053\u3068\u304c\u5206\u304b\u308a\u4e00\u4eba\u843d\u80c6\u3057\u305f\u3053\u3068\u3082\u8a18\u61b6\u306b\u65b0\u3057\u3044\u51fa\u6765\u4e8b\u3067\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u3061\u306a\u307f\u306b\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u767a\u52d5\u3059\u308b\u3088\u3046\u306b\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u3066\u304a\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u30a8\u30c7\u30a3\u30bf\u306e\u6642\u8a08\u30de\u30fc\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u30c8\u30ea\u30ac\u30fc\u30a6\u30a4\u30f3\u30c9\u30a6\u3092\u8868\u793a\u3055\u305b\u305f\u5f8c\u306b\u53f3\u4e0b\u306e\u300c\uff0b\u30c8\u30ea\u30ac\u30fc\u3092\u8ffd\u52a0\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u4e0b\u8a18\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><a href=\"https:\/\/i1.wp.com\/google-apps-script.net\/instructions\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png\"><img class=\"aligncenter size-large wp-image-646\" src=\"https:\/\/i0.wp.com\/google-apps-script.net\/instructions\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30-1024x563.png?resize=1024%2C563\" alt=\"\u30ab\u30ec\u30f3\u30c0\u30fc\u30c8\u30ea\u30ac\u30fc\u306e\u8a2d\u5b9a\u65b9\u6cd5\" width=\"1024\" height=\"563\" srcset=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png?resize=1024%2C563&amp;ssl=1 1024w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png?resize=300%2C165&amp;ssl=1 300w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png?resize=768%2C422&amp;ssl=1 768w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png?resize=304%2C167&amp;ssl=1 304w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png?resize=282%2C155&amp;ssl=1 282w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/Screenshot-2019-01-15-at-22.57.30.png?w=2000&amp;ssl=1 2000w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>\u4e0a\u8a18\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306e\u5de6\u4e0b\u306b\u3042\u308b\u300e\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u30aa\u30fc\u30ca\u30fc\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u300f\u3068\u3044\u3046\u90e8\u5206\u306b\u30ab\u30ec\u30f3\u30c0\u30fcID\u3092\u6307\u5b9a\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3053\u3068\u3067ID\u3068\u4e00\u81f4\u3059\u308b\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u7de8\u96c6\u3057\u305f\u6642\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u81ea\u52d5\u7684\u306b\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u3069\u3093\u306a\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u308b\u306e\u304b\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u3001\u7d50\u69cb\u304c\u3063\u304b\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u30ab\u30ec\u30f3\u30c0\u30fcID\u306e\u78ba\u8a8d\u65b9\u6cd5\u306f<a href=\"http:\/\/google-apps-script.net\/instructions\/?p=431\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u306b\u8a18\u8f09\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"1\">\u30ab\u30ec\u30f3\u30c0\u30fc\u30c8\u30ea\u30ac\u30fc\u3067\u4f55\u304c\u53d6\u5f97\u3067\u304d\u308b\u304b\u306a\uff1f<\/h3>\n<div id=\"codeheader_js\" class=\"codeheader\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c91<\/div>\n<div id=\"codebox\">\n<pre>\/\/\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u30c8\u30ea\u30ac\u30fc\u3067\u53d6\u5f97\u3067\u304d\u308b\u30c7\u30fc\u30bf\u78ba\u8a8d\nfunction sampleCode1(e) {\n  console.log(e);\n}<\/pre>\n<\/div>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u7d50\u679c\u3092\u30ed\u30b0\u3067\u307f\u3066\u307f\u308b\u3068\u30fb\u30fb\u30fb<\/p>\n<pre>{\n\u3000authMode=FULL,\n\u3000calendarId=h349j2dgs3rf6pj9f6v318qnqo@group.calendar.google.com,\n\u3000triggerUid=332753\n}<\/pre>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3053\u306e3\u3064\u3060\u3051\u304c\u53d6\u5f97\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\ncalendarId\u306f\u7de8\u96c6\u3055\u308c\u305f\u30ab\u30ec\u30f3\u30c0\u30fc\u306eID\uff08\u30c8\u30ea\u30ac\u30fc\u306b\u8a2d\u5b9a\u3057\u305fID\u3068\u540c\u3058\uff09<br \/>\ntriggerUid\u306f\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u30c8\u30ea\u30ac\u30fc\u306e\u4e00\u610f\u306e\u30c8\u30ea\u30ac\u30fcID<\/p>\n<p>\u3053\u3093\u306a\u3082\u306e\u3057\u304b\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u306a\u306e\u3067\u3001\u3069\u306e\u4e88\u5b9a\u304c\u8ffd\u52a0\/\u5909\u66f4\/\u524a\u9664\u3055\u308c\u305f\u306e\u304b\u3082\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3059\u3002<br \/>\n\u3053\u308c\u3060\u3051\u3060\u3068\u3042\u307e\u308a\u4f7f\u3048\u306a\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u3053\u3067\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u30b5\u30e9\u30b5\u30e9\uff5e\u3063\u3068\u8aad\u3093\u3067\u3044\u308b\u3068\u3001<\/p>\n<blockquote><p><i>Calendar event triggers are now available.You can use these triggers in conjunction with the Calendar advanced service to discover recently changed calendar events via regular sync operations.<\/i><\/p><\/blockquote>\n<p>\uff08\u65e5\u672c\u8a9e\u8a33\uff1a\u30ab\u30ec\u30f3\u30c0\u30fc\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3088\u3002\u3053\u306e\u30c8\u30ea\u30ac\u30fc\u306f\u4e0a\u4f4d\u30ab\u30ec\u30f3\u30c0\u30fc\u30b5\u30fc\u30d3\u30b9\u3068\u9023\u643a\u3055\u305b\u308b\u3053\u3068\u3067\u901a\u5e38\u306e\u540c\u671f\u30d7\u30ed\u30bb\u30b9\u3092\u901a\u3057\u3066\u6700\u8fd1\u7de8\u96c6\u3057\u305f\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u5185\u5bb9\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3063\u305b\uff01\uff09<\/p>\n<p>\u3068\u66f8\u3044\u3066\u3042\u308b\u306e\u3092\u767a\u898b\u3057\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3046\u306a\u3093\u3067\u3059\u3002\u3053\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u30c8\u30ea\u30ac\u30fc\u306fCalendarApp\u3067\u306f\u306a\u304f\u3001\u4e0a\u4f4d\u30ab\u30ec\u30f3\u30c0\u30fc\u30b5\u30fc\u30d3\u30b9\uff08calendar API\uff09\u3068\u9023\u643a\u3055\u305b\u308b\u3053\u3068\u3067\u521d\u3081\u3066\u771f\u4fa1\u3092\u767a\u63ee\u3059\u308b\u30c8\u30ea\u30ac\u30fc\u306a\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u306e<a href=\"https:\/\/developers.google.com\/apps-script\/guides\/triggers\/events#google_calendar_events\">\u30ea\u30f3\u30af\u5148<\/a>\u306b\u5c11\u3057\u8a73\u3057\u304f\u66f8\u3044\u3066\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u5185\u5bb9\u3054\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30ab\u30ec\u30f3\u30c0\u30fc\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc<\/h3>\n<blockquote><p><i>Calendar triggers fire when a user&#8217;s calendar events are updated (created, edited, or deleted).<\/i><\/p><\/blockquote>\n<p>\uff08\u65e5\u672c\u8a9e\u8a33\uff1a\u30ab\u30ec\u30f3\u30c0\u30fc\u30c8\u30ea\u30ac\u30fc\u306f\u30e6\u30fc\u30b6\u30fc\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u4e88\u5b9a\u304c\u66f4\u65b0\uff08\u65b0\u898f\u4f5c\u6210\u3001\u7de8\u96c6\u3001\u524a\u9664\uff09\u3055\u308c\u305f\u3068\u304d\u306b\u767a\u52d5\u3057\u307e\u3059\u3002\uff09<\/p>\n<blockquote><p><i>These triggers do not tell you which event changed or how it changed. Instead, they indicate that your code needs to do an incremental sync operation to pick up recent changes to the calendar. For a full description of this procedure, see the <\/i><i><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/sync\">Synchronizing resources guide<\/a><\/i><i> for the <\/i><i><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/overview\">Calendar API<\/a><\/i><i>.<\/i><\/p><\/blockquote>\n<p>\uff08\u65e5\u672c\u8a9e\u8a33\uff1a\u3053\u306e\u30c8\u30ea\u30ac\u30fc\u3060\u3051\u3067\u306f\u3069\u306e\u4e88\u5b9a\u304c\u7de8\u96c6\u3055\u308c\u305f\u304b\u3084\u3069\u306e\u3088\u3046\u306b\u7de8\u96c6\u3055\u308c\u305f\u304b\u3092\u77e5\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u305d\u306e\u4ee3\u308f\u308a\u306b\u3001\u3053\u306e\u30c8\u30ea\u30ac\u30fc\u306f\u30ab\u30ec\u30f3\u30c0\u30fc\u304c\u7de8\u96c6\u3055\u308c\u305f\u306e\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u30ab\u30ec\u30f3\u30c0\u30fc\u306b\u5dee\u5206\u540c\u671f\u3059\u308b\u5fc5\u8981\u304c\u6709\u308a\u307e\u3059\u3088\u3068\u3044\u3046\u3053\u3068\u3092\u6559\u3048\u3066\u304f\u308c\u307e\u3059\u3002\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u306e\u8a73\u3057\u3044\u8aac\u660e\u306f<a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/overview\">Calendar API<\/a>\u306e<a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/sync\">Syncronizing resources guide<\/a>\u3092\u3054\u78ba\u8a8d\u4e0b\u3055\u3044\u3002\uff09<\/p>\n<blockquote><p><i>To synchronize with Calendar in Apps Script, perform the following steps:<\/i><\/p><\/blockquote>\n<p>\uff08\u65e5\u672c\u8a9e\u8a33\uff1aGoogle Apps Script\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u540c\u671f\u3055\u305b\u308b\u305f\u3081\u306b\u306f\u3001\u6b21\u306e\u624b\u9806\u306b\u5f93\u3063\u3066\u4e8b\u524d\u6e96\u5099\u3092\u3057\u3066\u4e0b\u3055\u3044\u3002\uff09<\/p>\n<ol>\n<li>\n<blockquote><p><i>Enable the <\/i><i><a href=\"https:\/\/developers.google.com\/apps-script\/advanced\/calendar\">Calendar advanced service<\/a><\/i><i> for the script project. The built-in <\/i><i><a href=\"https:\/\/developers.google.com\/apps-script\/reference\/calendar\/\">Calendar service<\/a><\/i><i> isn&#8217;t sufficent for this workflow.<\/i><\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote><p><i>Determine what calendars should be synchronized. For each such calendar, perform an <\/i><i><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/sync#initial_full_sync\">intitial sync<\/a><\/i><i> operation using the Calendar advanced service&#8217;s <\/i><i><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/reference\/events\/list\">Events.list()<\/a><\/i><i> method.<\/i><\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote><p><i>The result of the initial sync returns a <\/i><i><code>nextSyncToken<\/code><\/i><i> for that calendar. Store this token for later use.<\/i><\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote><p><i>When the Apps Script <\/i><i><code>EventUpdated<\/code><\/i><i> trigger fires indicating a calendar event change, perform an <\/i><i><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/sync#incremental_sync\">incremental sync<\/a><\/i><i> for the affected calendar using the stored <\/i><i><code>nextSyncToken<\/code><\/i><i>. This is essentially another <\/i><i><a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/reference\/events\/list\">Events.list()<\/a><\/i><i> request, but providing the <\/i><i><code>nextSyncToken<\/code><\/i><i> limits the response to only events that have changed since the last sync.<\/i><\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote><p><i>Examine the response of the sync to learn what events were updated and have your code respond appropriately. For example, you can log the change, update a spreadsheet, send email notices, or take other actions.<\/i><\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote><p><i>Update the <\/i><i><code>nextSyncToken<\/code><\/i><i> you stored for that calendar with the one returned by the incremental sync request. This forces the next sync operation to only return the most current changes.<\/i><\/p><\/blockquote>\n<\/li>\n<\/ol>\n<p>\uff08\u65e5\u672c\u8a9e\u8a33\uff09<\/p>\n<ol>\n<li>\u5bfe\u8c61\u306eGAS\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u4e0a\u4f4d\u30ab\u30ec\u30f3\u30c0\u30fc\u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u5316\u3057\u3066\u4e0b\u3055\u3044\u3002\u521d\u671f\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u30b5\u30fc\u30d3\u30b9\uff08CalendarApp\uff09\u3067\u306f\u3053\u306e\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u4e0d\u5341\u5206\u3067\u3059\u3002<\/li>\n<li>\u3069\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u540c\u671f\u3055\u305b\u308b\u304b\u3092\u6c7a\u3081\u3066\u4e0b\u3055\u3044\u3002\u540c\u671f\u3055\u305b\u308b\u305d\u308c\u305e\u308c\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u306b\u5bfe\u3057\u3066\u3001\u4e0a\u4f4d\u30ab\u30ec\u30f3\u30c0\u30fc\u30b5\u30fc\u30d3\u30b9\u306e<a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/reference\/events\/list\">Events.list()<\/a>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u521d\u56de\u306e\u540c\u671f\u3092\u884c\u3063\u3066\u4e0b\u3055\u3044\u3002<\/li>\n<li>\u521d\u56de\u306e\u540c\u671f\u306e\u7d50\u679c\u3001\u5bfe\u8c61\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u306b\u5bfe\u3059\u308b<code>nextSyncToken<\/code>\u304c\u8fd4\u308a\u5024\u3068\u3057\u3066\u8fd4\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u3053\u306e\u30c8\u30fc\u30af\u30f3\u3092\u4fdd\u5b58\u3057\u3066\u4e0b\u3055\u3044\u3002<\/li>\n<li>GAS\u306e<code>EventUpdated<\/code>\uff08\u4e88\u5b9a\u5909\u66f4\uff09\u30c8\u30ea\u30ac\u30fc\u304c\u767a\u52d5\u3057\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u4e88\u5b9a\u304c\u5909\u66f4\u3055\u308c\u305f\u3053\u3068\u304c\u901a\u77e5\u3055\u308c\u305f\u3089\u3001\u5148\u7a0b\u4fdd\u5b58\u3057\u305f<code>nextSyncToken<\/code>\u3092\u4f7f\u3063\u3066\u5bfe\u8c61\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u5dee\u5206\u540c\u671f\u3092\u884c\u3063\u3066\u4e0b\u3055\u3044\u3002\u3084\u308a\u65b9\u306f\u5148\u7a0b\u3068\u540c\u3058\u3088\u3046\u306b<a href=\"https:\/\/developers.google.com\/google-apps\/calendar\/v3\/reference\/events\/list\">Events.list()<\/a>\u30e1\u30bd\u30c3\u30c9\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u306e\u3067\u3059\u304c\u3001<code>nextSyncToken\u3092<\/code>\u4e00\u7dd2\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3053\u3068\u3067\u524d\u56de\u540c\u671f\u3057\u3066\u304b\u3089\u5909\u66f4\u3055\u308c\u305f\u4e88\u5b9a\u306b\u3060\u3051\u9650\u5b9a\u3057\u3066\u8fd4\u308a\u5024\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/li>\n<li>\u3069\u306e\u4e88\u5b9a\u304c\u7de8\u96c6\u3055\u308c\u305f\u306e\u304b\u3092\u77e5\u308b\u305f\u3081\u306b\u3001\u5dee\u5206\u540c\u671f\u306e\u8fd4\u308a\u5024\u3092\u78ba\u8a8d\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u305d\u306e\u5f8c\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u9069\u5207\u306b\u51e6\u7406\u3055\u305b\u3066\u4e0b\u3055\u3044\u3002\u4f8b\u3048\u3070\u3001\u5909\u66f4\u70b9\u3092\u8a18\u9332\u3057\u305f\u308a\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u66f4\u65b0\u3057\u305f\u308a\u3001E\u30e1\u30fc\u30eb\u3067\u901a\u77e5\u3092\u9001\u3063\u305f\u308a\u3068\u3044\u3046\u3088\u3046\u306a\u51e6\u7406\u3092\u884c\u3063\u3066\u4e0b\u3055\u3044\u3002<\/li>\n<li>\u5dee\u5206\u540c\u671f\u304c\u7d42\u308f\u3063\u305f\u5f8c\u306b\u3001<code>nextSyncToken<\/code>\u306f\u5dee\u5206\u540c\u671f\u306e\u8fd4\u308a\u5024\u3067\u5f97\u3089\u308c\u308b<code>nextSyncToken<\/code>\u306b\u66f4\u65b0\u3057\u3066\u4e0a\u66f8\u304d\u4fdd\u5b58\u3057\u3066\u4e0b\u3055\u3044\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u6b21\u306b\u540c\u671f\u3055\u305b\u308b\u3068\u304d\u306b\u306f\u6700\u65b0\u306e\u5909\u66f4\u306e\u307f\u30c7\u30fc\u30bf\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u3053\u3068\u307f\u305f\u3044\u306a\u306e\u3067\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u624b\u9806\u3092\u30b3\u30fc\u30c9\u3067\u66f8\u3044\u3066\u4e0b\u8a18\u306b\u5171\u6709\u3057\u307e\u3059\u3002\u3068\u308a\u3042\u3048\u305a\u3001\u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u524d\u306b\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u30a8\u30c7\u30a3\u30bf\u306e\u4e0a\u90e8\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300e\u30ea\u30bd\u30fc\u30b9\u300f\u2192\u300eGoogle\u306e\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u300f\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066CalendarAPI\u3092\u6709\u52b9\u5316\u3057\u3066\u4e0b\u3055\u3044\u3002\u300eGoogle Cloud Platform API\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u300f\u3067Google Calendar API\u3092\u6709\u52b9\u5316\u3057\u3066\u3044\u306a\u3044\u4eba\u306f\u305d\u308c\u3082\u5408\u308f\u305b\u3066\u3053\u3053\u3067\u6709\u52b9\u5316\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4ed6\u306eAPI\u306e\u6709\u52b9\u5316\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u3066\u3044\u308b\u30da\u30fc\u30b8\u304c\u5225\u306b\u3042\u308b\u306e\u3067\u3001\u30ea\u30f3\u30af\u3092\u8cbc\u3063\u3066\u304a\u304d\u307e\u3059\u3002<a href=\"http:\/\/google-apps-script.net\/instructions\/?p=589#enableApi\">API\u306e\u6709\u52b9\u5316\u65b9\u6cd5<\/a><br \/>\nAPI\u306f\u5225\u3067\u3059\u304c\u3001\u624b\u9806\u306f\u30ea\u30f3\u30af\u5148\u306e\u65b9\u6cd5\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<h3 id=\"2\">initialSync<\/h3>\n<div id=\"codeheader_js\" class=\"codeheader\">\u521d\u56de\u306e\u540c\u671f\u3092\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9<\/div>\n<div id=\"codebox\">\n<pre>\/\/nextSyncToken\u3092\u30b9\u30af\u30ea\u30d7\u30c8\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u4fdd\u5b58\u3059\u308b\nfunction initialSync() {\n  var calendarId = \"h349j2dgs3rf6pj9f6v318qnqo@group.calendar.google.com\"; \/\/\u540c\u671f\u3055\u305b\u305f\u3044\u30ab\u30ec\u30f3\u30c0\u30fcID\u3092\u5165\u308c\u308b\n  var items = Calendar.Events.list(calendarId);\n  var nextSyncToken = items.nextSyncToken;\n  var properties = PropertiesService.getScriptProperties();\n  properties.setProperty(\"syncToken\", nextSyncToken);\n}<\/pre>\n<\/div>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u3044\u3046\u3068\u3053\u308d\u306bnextSyncToken\u3092\u4e00\u6642\u7684\u306b\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002\u30b9\u30af\u30ea\u30d7\u30c8\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u4fdd\u5b58\u3059\u308b\u3068\u95a2\u6570\u306e\u51e6\u7406\u304c\u5b8c\u4e86\u3057\u3066\u3082\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3057\u7d9a\u3051\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306e\u30b3\u30fc\u30c9\u306f\u3001\u4fdd\u5b58\u3057\u305f\u30c8\u30fc\u30af\u30f3\u3092\u5229\u7528\u3057\u3066\u5dee\u5206\u540c\u671f(\u5909\u66f4\u3057\u305f\u4e88\u5b9a\u306e\u60c5\u5831\u306e\u307f\u53d6\u5f97)\u3092\u3055\u305b\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002Calendar API\u304c\u6709\u52b9\u5316\u3067\u304d\u3066\u3044\u308c\u3070initialSync\u95a2\u6570\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046<\/p>\n<h3 id=\"3\">onCalendarEdit<\/h3>\n<div id=\"codeheader_js\" class=\"codeheader\">\u5dee\u5206\u540c\u671f\u3092\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9<\/div>\n<div id=\"codebox\">\n<pre>\/\/\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u81ea\u52d5\u7684\u306b\u8d77\u52d5\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\nfunction onCalendarEdit() {\n  var calendarId = \"h349j2dgs3rf6pj9f6v318qnqo@group.calendar.google.com\"; \/\/\u540c\u671f\u3055\u305b\u305f\u3044\u30ab\u30ec\u30f3\u30c0\u30fcID\u3092\u5165\u308c\u308b\n  var properties = PropertiesService.getScriptProperties();\n  var nextSyncToken = properties.getProperty(\"syncToken\");\n  var optionalArgs = {\n    syncToken: nextSyncToken\n  };\n  var events = Calendar.Events.list(calendarId, optionalArgs);\n  console.log(events);\n  var nextSyncToken = events[\"nextSyncToken\"];\n  properties.setProperty(\"syncToken\", nextSyncToken);\n}<\/pre>\n<\/div>\n<p>onCalendarEdit()\u3092\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u767a\u52d5\u3059\u308b\u3088\u3046\u306b\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a\u3057\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u66f4\u65b0\u3059\u308b\u3068\u4e00\u756a\u6700\u521d\u306e\u30b3\u30fc\u30c9\u3088\u308a\u3082\u591a\u304f\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u3069\u306e\u4e88\u5b9a\u304c\u3069\u306e\u3088\u3046\u306b\u66f4\u65b0\u3055\u308c\u305f\u306e\u304b\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br \/>\n\u4e0b\u8a18\u304c\u53d6\u5f97\u3067\u304d\u308b\u60c5\u5831\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>{\n\u3000summary=Made by GAS,\n\u3000nextSyncToken=CLjLo66H8N8CELjLo66H8N8CGAU=,\n\u3000kind=calendar#events,\n\u3000defaultReminders=[],\n\u3000accessRole=owner,\n\u3000timeZone=America\/New_York,\n\u3000etag=\"p32scn8tegvodu0g\",\n\u3000updated=2019-01-15T15:03:12.195Z,\n\u3000items=[\n\u3000\u3000{\n\u3000\u3000\u3000kind=calendar#event,\n\u3000\u3000\u3000etag=\"3095129184390000\",\n\u3000\u3000\u3000id=3g1i2rbsqc7ugsq3cphbpda92s,\n\u3000\u3000\u3000status=cancelled\n\u3000\u3000}\n\u3000]\n}<\/pre>\n<p>\u3088\u304f\u4f7f\u3046\u90e8\u5206\u306e\u30c7\u30fc\u30bf\u306e\u65e5\u672c\u8a9e\u8a33\u3092\u3064\u3051\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<ul style=\"list-style-type: square;\">\n<li>summary = \u30ab\u30ec\u30f3\u30c0\u30fc\u540d<\/li>\n<li>nextSyncToken = \u30c8\u30fc\u30af\u30f3<\/li>\n<li>updated = \u66f4\u65b0\u65e5\u6642<\/li>\n<li>items\u914d\u5217\u5185id = \u30a4\u30d9\u30f3\u30c8ID\uff08\u4e88\u5b9aID)<\/li>\n<li>items\u914d\u5217\u5185summary = \u4e88\u5b9a\u540d<\/li>\n<li>items\u914d\u5217\u5185status = \u7de8\u96c6\u533a\u5206\uff08confirmed = \u65b0\u898f\u4f5c\u6210 or \u4e88\u5b9a\u7de8\u96c6\u3001cancelled = \u4e88\u5b9a\u524a\u9664\uff09<\/li>\n<\/ul>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u306e\u6709\u52b9\u6d3b\u7528\u306e\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u30c8\u30ea\u30ac\u30fc\u306f\u4e0a\u4f4d\u30ab\u30ec\u30f3\u30c0\u30fc\u30b5\u30fc\u30d3\u30b9\u3068\u9023\u643a\u3055\u305b\u3066\u521d\u3081\u3066\u8f1d\u304d\u51fa\u3059\u30c8\u30ea\u30ac\u30fc\u3068\u3044\u3046\u3053\u3068\u304c\u304a\u5206\u304b\u308a\u3044\u305f\u3060\u3051\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u30a4\u30d9\u30f3\u30c8ID\u304c\u53d6\u5f97\u3067\u304d\u308c\u3070\u305d\u3053\u304b\u3089\u3055\u3089\u306b\u69d8\u3005\u306a\u64cd\u4f5c\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u66f4\u306b\u5e45\u304c\u5e83\u304c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u305c\u3072\u7686\u3055\u3093\u3082\u30ab\u30ec\u30f3\u30c0\u30fc\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u3092\u4f7f\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u958b\u767a\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p>\u4ee5\u4e0a\u3001\u5c0f\u30cd\u30bf\u3067\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u767a\u52d5\u3059\u308b\u30ab\u30ec\u30f3\u30c0\u30fc\u30c8\u30ea\u30ac\u30fc 2018\u5e742\u670826\u65e5\u306eGoogle Apps Script\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u7de8\u96c6\u3092\u5f15\u304d\u91d1\u306b\u3001Google Apps Script\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u30c8\u30ea\u30ac\u30fc\u304c\u8ffd\u52a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1389,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","spay_email":"","jetpack_publicize_message":"Google\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u306b\u767a\u52d5\u3059\u308b\u30c8\u30ea\u30ac\u30fc\u3092\u4f7f\u3044\u3053\u306a\u3059\r\n#GAS\r\n#GoogleAppsScript\r\n#CalendarApp\r\n#CalendarAPI\r\n#CalendarEventTrigger\r\n#\u30ab\u30ec\u30f3\u30c0\u30fc\u7de8\u96c6\u6642\u30c8\u30ea\u30ac\u30fc","jetpack_is_tweetstorm":false},"categories":[17,37,4,16,80,81],"tags":[85,66,53,51,52,55,50,54,82],"jetpack_featured_media_url":"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2019\/01\/onEditTriggerForCalendar.png?fit=320%2C180&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9Z92k-ap","jetpack_likes_enabled":true,"amp_validity":null,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/645"}],"collection":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":16,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":2205,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/645\/revisions\/2205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/media\/1389"}],"wp:attachment":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}