首页 > 解决方案 > 更改有关 CalendarApp.getallcalendards() 方法的范围

问题描述

在我的代码库中,我使用 CalendarApp.getallcalendar() 来拥有所有用户的日历。

此方法已获得此授权:

https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.readonly
https://www.google.com/calendar/feeds

在我的脚本的属性中,关于日历的范围是https://www.googleapis.com/auth/calendar 所以当用户访问我的脚本应用程序时,权限是:“......编辑和删除日历......”,但是我只需要阅读它。应该可以改吗?我想要这个范围:https ://www.googleapis.com/auth/calendar.readonly

标签: google-apps-scriptpublishing

解决方案


只需从范围数组中删除https://www.googleapis.com/auth/calendar,因为它为您提供读/写访问权限。在清单中更改它,然后尝试再次运行应用程序,并且应该要求您再次授权(使用新范围)。


推荐阅读