简体   繁体   English

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

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

i have a question regarding the Google Calendar API with C#. 我对使用C#的Google Calendar API有疑问。 I want to set the color of an specific event but whatever i add to the ColorId property, it does not affect my event after updating. 我想设置特定事件的颜色,但是无论我添加到ColorId属性中如何,它都不会影响更新后的事件。

Here ist my code: 这是我的代码:

 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();

Any ideas on how this doesn't work? 关于这怎么不起作用的任何想法?

Regards, Andreas 问候安德烈亚斯

Looks like its might be a bug CalendarList background color change is not working (.NET) 看起来它可能是一个错误, CalendarList背景颜色更改不起作用(.NET)

The only issue with this is that i have not been able to get it to set using the Google APIs exporer either. 唯一的问题是我也无法使用Google API Exporer对其进行设置。 which makes me wonder if this is something they removed after the release of the new Google calendar. 这让我想知道这是否是他们在发布新的Google日历后删除的内容。

I have sent off an email to Google but i dont have a direct contact on that team it make be a while before i hear anything. 我已经向Google发送了一封电子邮件,但是我没有与该团队直接联系,所以我要等一会儿才能听到。

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

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