首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何向CalendarEvent添加图标(flair)?

如何向CalendarEvent添加图标(flair)?
EN

Stack Overflow用户
提问于 2014-08-12 19:40:41
回答 2查看 2.2K关注 0票数 1

我正在使用Google脚本来创建/编辑一些CalendarEvents

如何向事件添加图标?

我知道我可以使用事件Flair小工具手动添加flair。但是如何使用Google脚本添加它们呢?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-05-07 14:06:17

使用高级日历服务,这是可能的。创建Google脚本文件和启用高级日历服务。

然后创建一个像这样的函数:

代码语言:javascript
复制
function createEventWithFlair() {
var calendarId = "Enter calendarID here" 
var title = "Enter a title here"
var location = "Enter a location here"
var description = "Enter a description <b>here</b>" // simple html (<a><b>) is allowed
var startTime = "Sat May 26 23:59:59 GMT+02:00 2017" // must be an ISO-string ==> var date = new Date().toISOString();
var endTime = "Sun May 27 23:59:59 GMT+02:00 2017"

var gadget = {}
    gadget.display = "chip"   //Change to "icon" if you only want an icon to appear in the Google Calendar
    gadget.iconLink = "https://gamesrfunny.weebly.com/uploads/9/5/5/8/9558194/bird-blue.ico" //Link to ico-file.
    gadget.height = 20 
    gadget.width = 20
    gadget.type = 'image/ico'

var event = {
    summary: title,
    location: location,
    description:description,
    start: {
      dateTime: startTime
    },
    end: {
      dateTime: endTime
    },
    attendees: guests,
    // Red background. Use Calendar.Colors.get() for the full list.
    colorId: 11,
    gadget: gadget,

  };


var event = Calendar.Events.insert(event, calendarId);
Logger.log(event.htmlLink)
}

属性的完整列表可以在资源表示页面中读取。

票数 1
EN

Stack Overflow用户

发布于 2014-08-14 14:02:57

不提供对事件图标的本地支持,API或Apps脚本也是如此。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25272737

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档