The following code has samples of how to create an event using the lib
http://code.google.com/apis/calendar/docs/1.0/developers_guide_js.html
Search for "Create new calendar"
Sample code:
======================
/*
* Create new calendar
*/
// Create the calendar service object
var calendarService = new google.gdata.calendar.CalendarService
('GoogleInc-jsguide-1.0');
// The default "owncalendars" feed is used to insert calendar to the
logged-in user
var feedUri = 'http://www.google.com/calendar/feeds/default/
owncalendars/full';
// Create an instance of CalendarEntry, representing the new calendar
var entry = new google.gdata.calendar.CalendarEntry();
// Set the calendar title
entry.setTitle(google.gdata.Text.create('JS-Client: insert
calendar'));
// Set the calendar summary
var summary = new google.gdata.Text();
summary.setText('This is a test calendar created by JS Client');
entry.setSummary(summary);
// Set the calendar timezone
var timeZone = new google.gdata.calendar.TimeZoneProperty();
timeZone.setValue('America/Los_Angeles');
entry.setTimeZone(timeZone);
// Set the calendar location
var where = new google.gdata.Where();
where.setLabel('Mountain View, CA');
where.setValueString('Mountain View, CA');
entry.addLocation(where);
// Set the calendar to be visible in the Google Calendar UI
var hidden = new google.gdata.calendar.HiddenProperty();
hidden.setValue(false);
entry.setHidden(hidden);
// Set the color that represent this calendar in the Google Calendar
UI
var color = new google.gdata.calendar.ColorProperty();
color.setValue('#2952A3');
entry.setColor(color);
// The callback method that will be called after a successful
// insertion from insertEntry()
var callback = function(result) {
PRINT('calendar created!');
}
// Error handler will be invoked if there is an error from insertEntry
()
var handleError = function(error) {
PRINT(error);
}
// Submit the request using the calendar service object
calendarService.insertEntry(feedUri, entry, callback,
handleError, google.gdata.calendar.CalendarEntry);
============================
Here is the page on the XML. Note that the above library generates
this XML under the hood and posts it for you.
I guess you're right with the <entry>
http://code.google.com/apis/calendar/docs/2.0/developers_guide_protocol.html#CreatingCalendars
Code snippet:
<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:gCal='http://schemas.google.com/gCal/2005'>
<title type='text'>Little League Schedule</title>
<summary type='text'>This calendar contains the practice schedule
and game times.</summary>
<gCal:timezone value='America/Los_Angeles'></gCal:timezone>
<gCal:hidden value='false'></gCal:hidden>
<gCal:color value='#2952A3'></gCal:color>
<gd:where rel='' label='' valueString='Oakland'></gd:where>
</entry>
On Aug 17, 1:42 am, Phyrefly <[email protected]> wrote:
> Thanks for that, my answers are below:
> Rich
>
> > A few issues:
> > 0) You are calling the <script src="../jsapi.js">, but not actually
> > using it for talking to the server. That's a bit confusing to me. It
> > renders a bunch of your code moot.
>
> Are you sure? I'm creating google.gdata.calendar.CalendarService
> objects, and using all kinds of API functions and objects, surely this
> is from that file?
>
> > 1) If you are writing the XML yourself, you need the correct prefix =
> > '<?xml version="1.0" encoding="UTF-8"?>';
>
> I've tried with that as well. No luck...
>
> > 2) GData is picky about the root being "<atom:entry>", and NOT
> > "<entry>"
>
> Tried that too. The example uses <entry> and the namespace
> declaration suggests that the "atom" prefix is unnecessary. But I
> thought I'd try anyway, and it didn't work.
>
> > 3) Your onClose: function() {fetchData(url,pCallBack,pData,pMethod);}
> > is missing the last arg. I suspect that it should be "onClose: function
> > () {fetchData(url,pCallBack,pData,pMethod, pHeaders);}"
>
> Thanks for that, I've added it now. That code is only called when
> initially authenticating, so isn't the problem, but would certainly
> have caused problems later!
>
> > 4) I don't think these are needed [though I'm not sure if they
> > actually hurt]
> > params[gadgets.io.RequestParameters.NUM_ENTRIES] = 100;
> > params[gadgets.io.RequestParameters.GET_SUMMARIES] = true;
>
> I've tried with and without all combinations of params that I could,
> to try to get it to work. Removing these didn't help. They are
> necessary for something else I'm doing in code though.
>
> > 5) If you don't use the jsapi libs, then you may want to double check
> > the line here for redirects "else if (response.data) {"
>
> Not sure I understand what you're suggesting here. This does what I
> want it to every time I've stepped through it so far. What do you
> think it's doing that it shouldn't? (or isn't that it should?)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---