Create an all-day event using Google Calendar API

2019-07-19 01:10发布

Iam working with C# and the Google Calendar API classes "CalendarService" and "Event". I want to upload an event to Google Calendar without any date (all-day). If i don't set the Event.End property, I get an exception.

How can I set my event as an all-day event ?

I've searched for a long time, without any solution...

2条回答
Fickle 薄情
2楼-- · 2019-07-19 01:48

Isn´t the marked answer Java???

He asked about 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",

            },

        };
查看更多
ら.Afraid
3楼-- · 2019-07-19 01:56

Add a new time with AllDay set to true:

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

entry.Times.Add(time);
查看更多
登录 后发表回答