Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 如何让其他所有者共享谷歌日历事件?_Google Apps Script_Google Calendar Api - Fatal编程技术网

Google apps script 如何让其他所有者共享谷歌日历事件?

Google apps script 如何让其他所有者共享谷歌日历事件?,google-apps-script,google-calendar-api,Google Apps Script,Google Calendar Api,我是日历api的新手,有几个基本问题 我想在所有日历上获取其他用户,tonya123456@gmail.com和我一起分享。她是主人,不是我 “此用户拥有或订阅了0.0日历”是我运行此代码时的响应: var calendar = CalendarApp.getCalendarsByName('tonya123456@gmail.com'); if(calendar == null){ //user may not have access, auto-subscribe them. calenda

我是日历api的新手,有几个基本问题

我想在所有日历上获取其他用户,tonya123456@gmail.com和我一起分享。她是主人,不是我

“此用户拥有或订阅了0.0日历”是我运行此代码时的响应:

var calendar = CalendarApp.getCalendarsByName('tonya123456@gmail.com');
if(calendar == null){
//user may not have access, auto-subscribe them.
calendar = CalendarApp.subscribeToCalendar('tonya123456@gmail.com', 
{hidden:true,selected:false});
}
Logger.log('This user owns or is subscribed to %s calendars.',
 calendar.length);

我知道的一种方法是列出所有你自己的事件,其中有一个你正在寻找的创建者。下面的函数将获取事件并返回与事件创建者匹配的事件ID数组。这不是一个包容性的解决方案,例如它没有日期范围或处理分页结果,只是实现这一点的一种简单方法

你会像这样使用它:

function myFunction(){
  var IDs = getEventIdsByCreator(myCalendarId,"tonya123456@gmail.com")
}
function myFunction(){
  var IDs = getEventIdsByCreator(myCalendarId,"tonya123456@gmail.com")
}