使用Google Calendar API制作全天活动

时间:2012-04-10 13:11:04

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

我使用C#和Google Calendar API类“CalendarService”和“Event”。 我想在没有任何日期(全天)的情况下将活动上传到Google日历。 如果我没有设置Event.End属性,我会得到一个例外。

如何将我的活动设为全天活动?

我搜索了很长时间,没有任何解决方案......

2 个答案:

答案 0 :(得分:4)

添加AllDay设置为true的新时间:

var entry = new EventEntry(title, description, "");
var time = new When();
time.StartTime = start;
time.AllDay = true;

entry.Times.Add(time);

答案 1 :(得分:1)

不是标记答案Java ???

他问了c#。

Event newEvent = new Event()
        {

            Summary = "5ummary",
            Location = "location avenue",
            Description = "description",
            Start = new EventDateTime()
            {
                Date = "2015-08-07",

            },
            End = new EventDateTime()
            {
                Date = "2015-08-07",

            },

        };