What is the problem you are having with the EventEntry?
The following code snippet creates a valid Calendar Event:
private static EventEntry InsertEvent(EventFeed feed, String title,
String author, DateTime startTime, DateTime endTime, bool fAllDay,
String place)
{
EventEntry entry = new EventEntry();
entry.Title = new AtomTextConstruct(
AtomTextConstructElementType.Title,
title);
entry.Authors.Add(new AtomPerson(AtomPersonType.Author , author));
entry.Published = DateTime.Now;
entry.Updated = DateTime.Now;
Where newPlace = new Where();
newPlace.ValueString = place;
entry.Locations.Add (newPlace);
When newTime = new When();
newTime.StartTime = startTime;
newTime.EndTime = endTime;
newTime.AllDay = fAllDay;
entry.Times.Add(newTime);
return feed.Insert(entry) as EventEntry;
}
Frank Mantek
On 7/4/06,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
First of all I have no problem to add Iteams my using atomEntry.
Simple, I can add iteams at the current date and time. But I want to
write my own date! Can I use AtomEntry? or is EventEntry better?
EventEntry entry2 = new EventEntry();
AtomEntry entry = new AtomEntry(); //new item
//Reminder
Reminder rem = new Reminder();
rem.Hours = 1;
entry2.Reminder = rem;
//Date
DateTime startTime =
DateTime.Parse("2006-06-05T15:00:00-08:00");
DateTime endTime =
DateTime.Parse("2006-06-07T17:00:00-08:00");
When eventTimes = new When();
eventTimes.StartTime = startTime;
eventTimes.EndTime = endTime;
entry2.Times.Add(eventTimes);
//Information
AtomPerson author = new
AtomPerson(AtomPersonType.Author);
author.Name = CalenderHashTable[0].ToString();
author.Email = CalenderHashTable[1].ToString();
entry2.Authors.Add(author);
entry2.Title.Text = CalenderHashTable[2].ToString();
entry2.Content.Content =
CalenderHashTable[3].ToString();
Uri postUri = new
Uri("http://www.google.com/calendar/feeds/[EMAIL PROTECTED]/private/full");
try
{
AtomEntry insert = service.Insert(postUri, entry2);
session.send("Adding your data.");
}
catch (Exception ee)
{
Console.WriteLine("Error: " + ee);
}
The code has two entry, one from EntryEvent and another from AtomEntry.
AtomEntry is ok, but I tried to add time with EntryEvent, with no
success. Can I add time with AtomEntry? Have looked at publish, but
never understood it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi
-~----------~----~----~----~------~----~------~--~---
- Re: Google Calendar - Date and time Frank Mantek
- Re: Google Calendar - Date and time [EMAIL PROTECTED]
- Re: Google Calendar - Date and time Frank Mantek
- Re: Google Calendar - Date and time [EMAIL PROTECTED]
- Re: Google Calendar - Date and time [EMAIL PROTECTED]
