繁体   English   中英

使用C#中的API设置Google日历事件的颜色

[英]Set the Color of a Google Calendar event with the API in C#

我对使用C#的Google Calendar API有疑问。 我想设置特定事件的颜色,但是无论我添加到ColorId属性中如何,它都不会影响更新后的事件。

这是我的代码:

 Event data = CalendarService.Events.Get("primary", id).Execute();
 data.Description = _GetDescription(done, notes, uniqueLinkId);

 Colors colors = CalendarService.Colors.Get().Execute();
 if (colors != null && colors.Calendar != null)
 {
      var color = colors.Calendar.FirstOrDefault(x => x.Value.Background == "#16a765");
      if (!string.IsNullOrWhiteSpace(color.Key))
      {
                data.ColorId = color.Key;
      }
 }

 var request = CalendarService.Events.Update(data, "primary", id);
 request.SupportsAttachments = true;
 request.SendNotifications = false;

 request.Execute();

关于这怎么不起作用的任何想法?

问候安德烈亚斯

看起来它可能是一个错误, CalendarList背景颜色更改不起作用(.NET)

唯一的问题是我也无法使用Google API Exporer对其进行设置。 这让我想知道这是否是他们在发布新的Google日历后删除的内容。

我已经向Google发送了一封电子邮件,但是我没有与该团队直接联系,所以我要等一会儿才能听到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM