I've written a entry form for our company employees to enter marketing courses into the DB and at the same time add them to a Google Calendar. The Calendar is accepting the events, but the coloration of the event is different from a "manually" entered event using Google's interface. This leads me to believe that there is some property I am not setting that is causing the events not to be show on the calendar once it is embedded in our other company web pages.
The code used to enter events:
// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("[email protected]", "xxxxxx");
CalendarQuery query = new CalendarQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarFeed resultFeed = (CalendarFeed)myService.Query(query);
Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
foreach (CalendarEntry centry in resultFeed.Entries)
{
litErrorMsg.Text += centry.Title.Text + "<br />";
if (centry.Title.Text == "[email protected]")
{
postUri = new Uri("https://www.google.com/calendar/feeds/" +
centry.SelfUri.ToString().Substring(centry.SelfUri.
ToString().LastIndexOf("/") + 1) + "/private/full");
break;
}
}
Google.GData.Calendar.EventEntry entry = new Google.GData.Calendar.EventEntry();
// Set the title and content of the entry.
entry.Title.Text = eventName;
entry.Content.Content = eventName;
//entry.QuickAdd = true;
entry.EventVisibility = new Google.GData.Calendar.EventEntry.Visibility("event.public");
When eventTime = new When(Convert.ToDateTime(startDate), Convert.ToDateTime(endDate));
entry.Times.Add(eventTime);
GDataGAuthRequestFactory requestFactory = (GDataGAuthRequestFactory)myService.RequestFactory;
requestFactory.CreateRequest(GDataRequestType.Insert, postUri);
// Send the request and receive the response:
AtomEntry insertedEntry = myService.Insert(postUri, entry);
And this is the resulting calendar:
The "test event jasdf event" is the manually entered event, and the two events: "Test event 234" are the programmatically entered events. In any case, once I embed the calendar, the only event showing up is the "test event jasdf".
I tried to manually set the event to PUBLIC but that didn't seem to help.
Anyone faced this issue before or had success with google calendar? If so, I'd like to see what you might have used to successfully create events and publish them.
Thanks!