Google apps script 在iframe中生成多个日历

Google apps script 在iframe中生成多个日历,google-apps-script,google-calendar-api,google-apps,Google Apps Script,Google Calendar Api,Google Apps,我有一个GoogleAppsforEducation帐户和一个运行在小工具中的应用程序脚本,它可以获取用户所属/拥有的所有日历。然后,我根据它们的角色生成URL。管理员用户似乎可以看到他们所有的日历,但普通用户需要特别单击Subscribe to calendar或visit,然后重新加载该小工具才能查看他们的日历 if (role == "student") { url = "https://www.google.com/calendar/embed? sho

我有一个GoogleAppsforEducation帐户和一个运行在小工具中的应用程序脚本,它可以获取用户所属/拥有的所有日历。然后,我根据它们的角色生成URL。管理员用户似乎可以看到他们所有的日历,但普通用户需要特别单击Subscribe to calendar或visit,然后重新加载该小工具才能查看他们的日历

 if (role == "student") {
    url = "https://www.google.com/calendar/embed?        
    showTitle=0&showTabs=1&showCalendars=1&height=600&wkst=2&mode=DAY&showTitle=0&" +         replaceStr + "&ctz=Australia%2FVictoria&dates=" + startDate + "/" + startDate;
   } else if (role == "parent") {
  url = "https://www.google.com/calendar/embed?showTitle=0&showTabs=1&showCalendars=1&height=600&wkst=2&mode=MONTH&showTitle=0&"    + replaceStr + "&ctz=Australia%2FVictoria&dates=" + startDate + "/" + startDate;
     } else if (role == "teacher") {
  url = "https://www.google.com/calendar/embed?showTitle=0&showBorderTitle=1&showTabs=1&showCalendars=1&height=600&wkst=2&mode=WE   EK&showTitle=0&" + replaceStr + "&ctz=Australia%2FVictoria&dates=" + startDate +  "/" + startDate;
    } else {
 url = "https://www.google.com/calendar/embed?showTitle=0&showBorderTitle=1&showTabs=1&showCalendars=1&height=600&wkst=2&mode=MO  NTH&showTitle=0&" + replaceStr + "&ctz=Australia%2FVictoria&dates=" + startDate + "/" + startDate;
 }
以下是获取所有用户日历的代码:

var calendars = CalendarApp.getAllCalendars();
 var calendarIDs = [];
 for (var i=0;i<calendars.length;i++) {
  calendarIDs.push(calendars[i].getId()); 
 }
 Logger.log(calendarIDs);
 return calendarIDs;
} 
有办法解决这个问题吗?我尝试过谷歌日历权限,编辑url参数,并在我的应用程序脚本中使用UrlFetchApp异步加载页面,但没有成功。如有任何建议或任何人有与此相同的问题,将不胜感激


更新我可以显示用户拥有的日历,但除非执行上述过程,否则无法查看所有域用户共享的日历。我们是否无法显示非公共且非用户所有、仅共享的日历?

问题在于两个日历不允许嵌入。这些是联系人日历和假日日历。一旦我从replaceStr字符串中取出这些日历,我就能够在GAS iframe中成功加载最多16个日历

更正代码:

var calendars = CalendarApp.getAllCalendars();
          var calendarIDs = [];
          var notCalendarIDs = [];   
          for (var i=0;i<calendars.length;i++) {
              Logger.log("All calendars " + calendars[i].getId());

              if (calendars[i].getId() != "en.australian#holiday@group.v.calendar.google.com" && calendars[i].getId() != "#contacts@group.v.calendar.google.com") {
                 calendarIDs.push(calendars[i].getId());
              } 
         }

我不确定我在你的帖子里看到了什么问题?对不起,我会尽快澄清