首页 文章

为什么不是谷歌应用程序脚本发送邀请

提问于
浏览
3

Google Apps脚本在下面的电子表格中运行,除发送邀请外,一切正常 . 使用 sendInvites:true 将在日历中创建事件,并添加访客但不会发送电子邮件 . 我没有使用 var advancedArgs 并尝试相同的结果 .

if (eventImported  != EVENT_IMPORTED && title != "") {  // Prevents importing duplicates
    var cal = CalendarApp.openByName('calendarname');
    var advancedArgs = {description: details, location: cust, guests:guestlist, sendInvites:true};

    cal.createEvent("10% Complete-->"+title, startDate, endDate, {description: details, location: cust, guests:guestlist, sendInvites:true});
    sheet.getRange(startcolumn + i, 9).setValue(EVENT_IMPORTED);

4 回答

  • 0

    错误必须在其他地方,我在这个简化版本中测试了您的代码,我按预期收到了邀请 . (我在很多脚本中经常使用这个选项而没有任何问题)

    你能告诉我你如何得到你的客人名单吗?它是documentation中指定的逗号分隔的电子邮件列表吗?

    function testcal(){
        var cal = CalendarApp.getDefaultCalendar()
        var advancedArgs = {description: 'details', location: 'here', guests:'serge@xxx.com', sendInvites:true};// change the email adress to a valid one that you have access to (but not your email adress of course !
        var startDate = new Date();// now
        var endDate = new Date(startDate.setHours(10));// at 10 AM, change this according to time of the day when you (eventually) test it
        cal.createEvent("test to delete", startDate, endDate, advancedArgs);
        }
    
  • 2

    我怀疑你可能在某个地方受到限制 . 我遇到了类似的问题,发送电子邮件会偶尔发生 . 我正在查看一组用户日历,当我在某个时间找到足够的可用时,我会向所有用户发送邀请 .

    我沮丧地补充道:

    使用Utilities.sleep(30000);

    就在我创建活动之前,它现在可靠地工作 . 你可以用更少的时间逃脱,但我的凌晨2点触发,所以我不在乎 .

  • -1

    我发现 no event invitation is sent to my own email address (虽然事件被添加到我的日历中) . 但事件邀请已正确发送给其他访客 .

  • 0

    试用:var advancedArgs = {description:details,location:cust,guests:guestlist,sendInvites:“TRUE”};

相关问题