Hi,
This is a code snippet of how to create an event using the C# client library
-
public void createEvent() {
CalendarService calendarService = new
CalendarService("calendar_service");
calendarService.setUserCredentials("username", "pw");
EventEntry entry = new EventEntry();
entry.Title.Text = "Lunch";
entry.Content.Type = "html";
entry.Content.Content = "Lunch with friends";
// Set a location for the event.
Where eventLocation = new Where();
eventLocation.ValueString = "Mountain View, CA";
entry.Locations.Add(eventLocation);
// Set time
When when = new When();
when.StartTime = DateTime.Parse("July 17, 2008 12:00:00 PM");
when.EndTime = when.StartTime.AddMinutes(60);
entry.Times.Add(when);
Uri postUri = new Uri("
http://www.google.com/calendar/feeds/default/private/full");
AtomEntry insertedEntry = calendarService.Insert(postUri, entry);
}
Hope it helps,
Austin
On Wed, Jul 16, 2008 at 4:53 AM, summer_2008 <[EMAIL PROTECTED]> wrote:
>
> I am trying to add events to my google calendar in C# .
>
> The following links says
>
> http://code.google.com/apis/calendar/developers_guide_protocol.html#CreatingEvents
>
> to create an event entry and send a POST request to the default URL.
>
> I have written the following code to accomplish this:
>
> [code] <code> <pre>
>
> CalendarService service = new CalendarService("My App");
> service.setUserCredentials(username, password);
>
> Uri calendarUri= new Uri("http://www.google.com/calendar/feeds/default/
> private/full <http://www.google.com/calendar/feeds/default/private/full>
> ");
>
> //1. First, create an entry of the Event kind
> EventEntry entry = new EventEntry("title", "desc");
>
> //2 POST - how????
> service.EntrySend(calendarUri, entry,
> Google.GData.Client.GDataRequestType.Insert); //insert the entry
>
> [/code] </code> </pre>
>
> First, I do not know whether it's the correct way of doing that. I
> went through the sample code inside /samples/calendar and it used
> service.query to make a GET request to obtain the feed. But I could
> not find any way to make a http post request.
>
> Second, in the above sample code, I do not know how to set event time
> time i.e. the event will be added for the time at which this request
> is made (current date and time when program is run).
>
> Please help.
> >
>
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---