简体   繁体   中英

Create an all-day event using Google Calendar API

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...

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

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",

            },

        };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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