当创建谷歌日历或通过UI修改其设置时,有一个"Location“字段。我想通过Google脚本(GAS)获得该字段的价值。
不幸的是,它似乎要么没有文档,要么没有通过气体日历API公开。我已经搜过网了,但是我想确保我没有忽略任何东西。
请注意:我指的不是事件位置,而是日历本身的“位置”字段,它是通过UI中的“日历设置”输入的。
发布于 2017-04-23 14:04:34
尝试使用高级日历服务
高级日历服务允许您在Apps脚本中使用公共Google Calendar API。就像Apps脚本的内置日历服务一样,这个API允许脚本访问和修改用户的Google,包括用户订阅的额外日历。在大多数情况下,内置服务更容易使用,但是这种高级服务提供了一些额外的功能,包括设置单个事件的背景色。
然后阅读历法引用。
资源陈述:
{
"kind": "calendar#calendar",
"etag": etag,
"id": string,
"summary": string,
"description": string,
"location": string,
"timeZone": string
}注意:
location -地理位置的日历作为自由形式的文本.可选。
这意味着您可以得到一个位置,也可以没有(如果没有设置)。
还可以为日历:插入和日历:获取尝试这个API来了解日历位置是如何工作的。
希望这能有所帮助。
发布于 2017-04-22 08:20:00
使用Google脚本中的日历服务,有两种设置位置的方法。使用createEvent()方法,您可以在options参数中包括位置和其他元数据:
// Creates an event for the moon landing and logs the ID.
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
new Date('July 20, 1969 20:00:00 UTC'),
new Date('July 20, 1969 21:00:00 UTC'),
{location: 'The Moon'});
Logger.log('Event ID: ' + event.getId());另外,还有一个用于setLocation()的CalendarEvent方法。
// Creates an event for the moon landing and logs the ID.
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
new Date('July 20, 1969 20:00:00 UTC'),
new Date('July 20, 1969 21:00:00 UTC'));
event.setLocation('The Moon');
Logger.log('Event ID: ' + event.getId());https://stackoverflow.com/questions/43550310
复制相似问题