Google.Apis,c#,google calendar api。不设置或更改colorId

时间:2017-09-11 12:09:25

标签: c# .net google-calendar-api

using Google.Apis.Auth.OAuth2;
using Google.Apis.Calendar.v3;
using Google.Apis.Calendar.v3.Data;
using Google.Apis.Services;
using Google.Apis.Util.Store;
    public async Task UpdateEvent(long? itemId)
    {
        GoogleAppointmentEvent eventInfo = new GoogleAppointmentEvent();


        eventInfo = ...//get some event description 
        Event myEvent = new Event
        {

            Summary = eventInfo.Summary,

            //Location = "Somewhere",
            Description = eventInfo.Description,
            Start = new EventDateTime()
            {
                DateTime = eventInfo.Start,
                TimeZone = "America/Los_Angeles"
            },
            End = new EventDateTime()
            {
                DateTime = eventInfo.EndPeriod,
                TimeZone = "America/Los_Angeles"
            },
            ColorId = eventInfo.Color,
            Recurrence = new String[] {
        "RRULE:FREQ=WEEKLY;BYDAY=MO"
    },
            Attendees = new List<EventAttendee>()
        {
          new EventAttendee() { Email = "my_email@gmail.com" }

            }
        };

        string test = "11";
        myEvent.ColorId = test;
            Event recurringEvent = _service.Events.Update(myEvent, "primary", eventInfo.EventId).Execute();
    }

我可以更改除colorId之外的任何属性的值。我可以更改除此之外的任何属性的值。当我更改它或设置新事件时它不会改变。当我使用Try this API和我的参数时,它会将colorId更改为其他值。当我尝试设置无效值时,我会捕获带有错误的回调,因此会触发对该字段值的验证。有任何想法如何解决这个问题?

0 个答案:

没有答案