【问题标题】:why isn't google apps script sending invitations为什么谷歌应用程序脚本不发送邀请
【发布时间】:2013-01-23 16:54:23
【问题描述】:

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);

【问题讨论】:

  • 你找到原因了吗?

标签: google-apps-script google-calendar-api


【解决方案1】:

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

你能说明你是如何得到你的客人名单的吗?它是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 点触发,所以我不在乎。

    【讨论】:

      【解决方案3】:

      我发现没有活动邀请发送到我的自己的电子邮件地址(尽管活动已添加到我的日历中)。但活动邀请已正确发送给其他客人。

      【讨论】:

        【解决方案4】:

        试用: var advancedArgs = {描述:详细信息,位置:客户, 客人:客人名单,发送邀请:“真”};

        【讨论】:

        猜你喜欢
        • 2015-12-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多