A 15 year old girl saves 40 elementary school kids and that's why she is my hero!

Small Google Calendar Class To Add Events

17. September 2013 18:22 by Scott in C#  //  Tags:   //   Comments (0)

I created a small C# class to add Google calendar events to a calendar in C#.  It is quite simple, but I didn’t find it searching the internet, so here it is.  Its dead simple.

 public class GoogleCalendar
    {

        private static string GoogleUrl = "http://www.google.com/calendar/event?action=TEMPLATE";
        public string What { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Description { get; set; }
        public string Location { get; set; }
        public string WebsiteName { get; set; }
        public string Website { get; set; }

        public string GetGoogleUrl()
        {
            //20130918T103000Z
            return GoogleUrl + "&text=" + What + "&dates=" + StartDate.ToString("yyyyMMddTHHmmssZ") + "/" + EndDate.ToString("yyyyMMddTHHmmssZ") + "&details=" + Description + "&location=" + Location + "&trp=false" + "&sprop=" + WebsiteName + "&sprop=name:" + Website;
        }
    }