<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Boundary Conditions &#187; SecondaryCalendarEvents</title>
	<atom:link href="http://67central.com/bc/category/gdata/gcalendar/secondarycalendarevents/feed/" rel="self" type="application/rss+xml" />
	<link>http://67central.com/bc</link>
	<description>Exploring Calendars, Time Lines, Timekeeping and Scheduling Tools</description>
	<lastBuildDate>Fri, 26 Jun 2009 14:44:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Events to Secondary Google Calendars in Python</title>
		<link>http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/</link>
		<comments>http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 19:49:42 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[SecondaryCalendarEvents]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=86</guid>
		<description><![CDATA[Before writing, I assumed that I would need to refer any reader to the introductory post of this series on adding events to secondary calendars. Depending on your skill level and experience that may still be true, and it definitely is true if you want to understand what you are doing, but if you just [...]]]></description>
			<content:encoded><![CDATA[<p>Before writing, I assumed that I would need to refer any reader to the <a href="http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/">introductory post</a> of this series on adding events to secondary calendars. Depending on your skill level and experience that may still be true, and it definitely is true if you want to understand what you are doing, but if you just want to get it done, you can probably muddle through with the following instructions. </p>
<p>Here&#8217;s the really short story: when you call the <a href="http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.calendar.service.html">insertEvent</a> method, you pass the event that you are creating and optionally, the edit url of the calendar where you want the event to appear. So, to create an event on a secondary calendar, just pass the edit link of the calendar. (You can get the edit link of a calendar in python by calling <code>GetEditLink().href</code> on it.)</p>
<p>For the longer story, I&#8217;ll assume that you have installed Python, ElementTree and the Google Data Python Library, following <a href="http://code.google.com/apis/gdata/articles/python_client_lib.html">Google&#8217;s instructions</a>. </p>
<p>Run through the tests and the sample code. When I ran the calendarExample.py it failed with this stack trace:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Traceback <span style="color: #7a0874; font-weight: bold;">&#40;</span>most recent call <span style="color: #c20cb9; font-weight: bold;">last</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>:
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">577</span>, <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">&lt;</span>module<span style="color: #000000; font-weight: bold;">&gt;</span>
    main<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">574</span>, <span style="color: #000000; font-weight: bold;">in</span> main
    sample.Run<span style="color: #7a0874; font-weight: bold;">&#40;</span>delete<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">498</span>, <span style="color: #000000; font-weight: bold;">in</span> Run
    self._PrintAllEventsOnDefaultCalendar<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">99</span>, <span style="color: #000000; font-weight: bold;">in</span> _PrintAllEventsOnDefaultCalendar
    print <span style="color: #ff0000;">'\t\t\t%s'</span> <span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>a_participant.attendee_status.value,<span style="color: #7a0874; font-weight: bold;">&#41;</span>
AttributeError: <span style="color: #ff0000;">'NoneType'</span> object has no attribute <span style="color: #ff0000;">'value'</span></pre></div></div>

<p>Since all I wanted to do was to make this sample code run for the single case of adding an event to a secondary calendar, I commented out line 99, but the code should be checking that there is an attendee status before writing its value. After that change the sample code ran fine for me.</p>
<p>To insert a single event in a secondary calendar, I copied <code>calendarExample.py</code> to <code> secondaryCalendarInsert.py</code>. Then I commented out everything in the <code>Run</code> method except this line:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>503
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">    see = <span style="color: #008000;">self</span>._InsertSingleEvent<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>and made the following change,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>266
267
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">new_event = <span style="color: #008000;">self</span>.<span style="color: black;">cal_client</span>.<span style="color: black;">InsertEvent</span><span style="color: black;">&#40;</span>event, 
  <span style="color: #483d8b;">'/calendar/feeds/g5b79g3f2bi5hc1it41seuu41c@group.calendar.google.com/private/full'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>This instructs the InsertEvent method to create the event in my secondary calendar by <code>POST</code>ing to the url of  my &#8220;Secondary Calendar&#8221; (id <code>g5b79g3f2bi5hc1it41seuu41c@group.calendar.google.com</code>) instead of my primary calendar (id <code>default</code>). I found the calendar ID on the calendar settings page of the calendar, but as I said above, if you have accessed a calendar programatically, you can just call <code>GetEditLink().href</code> on it to get the proper link.</p>
<p>You can see that a &#8220;One Time Tennis with Beth&#8221; event was inserted beginning at the moment I did the insert and lasting for one hour, as described in the sample code. </p>
<p>[Update 2008-11-14: You can't see this if you are using Safari. In general embedded calendar's show in Safari, but there is something about this particular calendar that causes it not to display. Google does a number of separate calls and redirects to obtain the correct data for this calendar and it looks like one of the calls returns data that doesn't correspond to the mime-types. The point that I was trying to communicate with this illustration was that the event did in fact appear and that it was on the secondary calendar.]</p>
<p><iframe src="http://www.google.com/calendar/embed?showTitle=0&amp;showNav=0&amp;showDate=0&amp;showPrint=0&amp;showTabs=0&amp;showTz=0&amp;mode=WEEK&amp;dates=20080928%2F20081004&amp;height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=calendar.maven%40gmail.com&amp;color=%232952A3&amp;src=g5b79g3f2bi5hc1it41seuu41c%40group.calendar.google.com&amp;color=%235229A3&amp;ctz=America%2FLos_Angeles" style=" border-width:0 " width="600" height="600" frameborder="0" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding Events to Secondary Google Calendars</title>
		<link>http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/</link>
		<comments>http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 19:00:59 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[SecondaryCalendarEvents]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=20</guid>
		<description><![CDATA[The most frequently asked question posed in the Google Calendar Date API Group is, &#8220;How do I add events to a secondary calendar?&#8221;
In this series of posts, I am going to attempt to provide an answer for using every language that has a client library. I discuss the &#8220;official&#8221; client libraries for Python, Php, .NET, [...]]]></description>
			<content:encoded><![CDATA[<p>The most frequently asked question posed in the <a href="http://groups.google.com/group/google-calendar-help-dataapi">Google Calendar Date API Group</a> is, &#8220;How do I add events to a secondary calendar?&#8221;</p>
<p>In this series of posts, I am going to attempt to provide an answer for using every language that has a client library. I discuss the &#8220;official&#8221; client libraries for Python, Php, .NET, Java and Javascript as well as the slightly less official Objective-C library and some of the attempts to create Ruby library for interacting with Google Calendar and GData. If there are other client libraries, just let me know in the comments and I&#8217;ll add instructions here, or link to them elsewhere as I have time, interest and understanding.</p>
<p>I start with describing how to POST XML to a calendar url. This is &#8220;The Protocol&#8221;.  You should read this information about the protocol, even if you plan to use a client library. Each client library is using this protocol under the covers, so understanding what is happening will help you better use your client library. In addition, I&#8217;ll only explain some terms in this section, so you&#8217;ll need to read it to understand what I am talking about.</p>
<p>All information in these posts comes from the Google Developer&#8217;s Guides, the Client Library Documentation, the source code for the client library and my own exploration and testing. I&#8217;ll provide links to these resources in the text as appropriate. For simplicity&#8217;s sake, I only cover creating single-occurrence events for users that have properly authenticated using client login. These cases should be sufficient for illustrating how to add to secondary calendars, but 1) I&#8217;m not aware of any differences in creating single-occurrence versus quickadd or recurrent events on secondary calendars in any of the client libraries and 2) I haven&#8217;t used AuthSub. </p>
<p>I have personally tested all of the code that I present here, unless otherwise noted. That means that I was able to create an event on a calendar using that code. In all cases, I am adding events to my <a href="http://www.google.com/calendar/embed?src=2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com&#038;ctz=America/Los_Angeles">Secondary Calendar</a> which is public, so have a look. I&#8217;ll be trying to add an event that occurs at the time when the relevant article is posted.</p>
<p>Here is a table of contents of the language-specific treatments. I&#8217;ll update the links as I complete the sections.</p>
<p><a href="http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/">Python</a> &#8211; Complete September 29, 2008<br />
Php<br />
.NET<br />
Java<br />
Javascript<br />
Objective C<br />
Ruby</p>
<p><span id="more-20"></span></p>
<h2>The Protocol</h2>
<p>To create an event on any Google Calendar you POST the appropriate XML to the calendar&#8217;s url. The easiest way to obtain the appropriate XML is to start with an existing event. The easiest way to obtain the calendar&#8217;s url, well, that&#8217;s a really the rub.</p>
<p>Here&#8217;s what Google says about finding the appropriate url:</p>
<blockquote><p>To post an entry, send the following HTTP request to Calendar, using a special &#8220;default&#8221; URL (and an Authorization header; see the section on authentication above). Calendar automatically redirects the default URL to the URL of the read/write private feed of the calendar belonging to the authenticated user. (Note that you don&#8217;t have to use the default URL to send a POST request to Calendar; you can specify the user ID instead of &#8220;default&#8221; if you prefer. For more information, see the <a href="http://code.google.com/apis/calendar/reference.html#Feeds">Calendar feed types</a> reference.)</p></blockquote>
<p>This is the source of all the confusion on the issue of creating events on secondary calendars.<br />
As mentioned  further on after this quote, the &#8220;default&#8221; URL is<br />
<code>http://www.google.com/calendar/feeds/default/private/full</code><br />
If you specify the user ID, this would be <code>http://www.google.com/calendar/feeds/user@gmail.com/private/full</code>, you get another URL for the user&#8217;s primary calendar. You can POST to this url and create events. </p>
<p>The question is, what is the user ID for a secondary calendar? If the calendar belongs to your friend, then <code>http://www.google.com/calendar/feeds/friend@gmail.com/private/full</code> works. Suppose that I have created a personal calendar and a work calendar. The user ID for my personal (primary) calendar is my gmail address. What is the user ID for my work calender? My gmail address? No, that is the user ID for my personal calendar. </p>
<p>The problem is that Google doesn&#8217;t use the term user ID consistently and what they really mean here is what they call calendar ID in <a href="http://code.google.com/apis/calendar/developers_guide_protocol.html#UpdatingCalendars">other contexts</a>.</p>
<p>To get the calendar ID, there are a couple of methods. </p>
<p>Google suggests that you parse the calendar ID from the calendar&#8217;s edit link in the allcalendars feed. Here is the entire entry for my secondary calendar from the all calendar&#8217;s feed.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  http://www.google.com/calendar/feeds/default/allcalendars/full/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T05:24:24.673Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T04:13:31.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Secondary Calendar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;summary</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>This calendar is for testing and
  illustrating the creation of events using the Google Calendar
  Data API on a secondary calendar.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/summary<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">src</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'http://schemas.google.com/acl/2007#accessControlList'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/acl/full'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/default/allcalendars/full/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'edit'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/default/allcalendars/full/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Secondary Calendar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:timezone</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'America/Los_Angeles'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:timesCleaned</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:hidden</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'false'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:color</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'#5229A3'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:selected</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'true'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:accesslevel</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'owner'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:where</span> <span style="color: #000066;">valueString</span>=<span style="color: #ff0000;">''</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>So, Google is suggesting that you take the element <code>&lt;link rel='edit' ...  .&gt;</code> element , parse out the href, extract the calendar ID, &#8220;2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com&#8221;, and substitute it into &#8220;http://www.google.com/calendar/feeds/default/<calendar ID>/full&#8221;. That works, but isn&#8217;t the most intuitive series of steps.</p>
<p>A more direct way is to just use the <code>src</code> attribute of the content. Since the content of the calendar is empty, <a href="http://tools.ietf.org/html/rfc4287#section-4.1.3">Atom specifies</a> that the <code>src</code> attribute must be present, and contain a link to the content. That&#8217;s a long way of saying, &#8220;This is the link that we want!&#8221; To read the content of a calendar, GET the url indicated by the <code>src</code> attribute link of the content. To create an event, POST appropriately formed XML to the <code>src</code> attribute link of the calendar. This is REST 101.</p>
<p>Note that the link in the <code>src</code> attribute of the content is exactly the same as the <code>alternate</code> link. This might be useful information as we work through the various client libraries.</p>
<p>The easiest method is to look it up manually through the UI. In the UI, under the Calendar Details tab of Calendar Settings, there is a section for Calendar Address and included in that section is a parenthetical notation of the Calendar ID. </p>
<p>Note that this is called Calendar ID whether the calendar is the user&#8217;s primary calendar (in which case the calendar ID is also the user ID) or a secondary calendar, in which case it is some other user&#8217;s email address, or a long string that looks like an e-mail address for an obscure user in the group.calendar.google.com domain, like <code>2v78cr597kh4kduf3db9t4p1es@group.calendar.google.com</code>. That by the way is the calendar ID in my <a href="http://www.google.com/calendar/embed?src=2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com&#038;ctz=America/Los_Angeles">Secondary Calendar</a>. You can see how Google has used the calendar ID as the <code>src</code> parameter in the link to that calendar, <code>http://www.google.com/calendar/embed?src=2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com</code>.</p>
<p>So now the hard part is over. We have the correct url. Here&#8217;s the XML that we&#8217;ll send as the data in our post request, cribbed from the <a href="http://code.google.com/apis/calendar/developers_guide_protocol.html#CreatingEvents">Developer&#8217;s Guide</a> and modified for our purposes. Follow that link for more details about how additional elements will be added on creation.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">'http://www.w3.org/2005/Atom'</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:gd</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#kind'</span></span>
<span style="color: #009900;">    <span style="color: #000066;">term</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event'</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>POSTed XML<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>I was POSTed using hand-crafted XML via the Protocol!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:transparency</span></span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.opaque'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:transparency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:eventStatus</span></span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.confirmed'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:eventStatus<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:when</span> <span style="color: #000066;">startTime</span>=<span style="color: #ff0000;">'2008-09-01'</span></span>
<span style="color: #009900;">    <span style="color: #000066;">endTime</span>=<span style="color: #ff0000;">'2008-09-02'</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/gd:when<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Wrap this up in a script that I have that does authentication and handles the redirects and POST that <code>&lt;entry&gt;</code> to</p>

<div class="wp_syntax"><div class="code"><pre class="xm" style="font-family:monospace;">https://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es@group.calendar.google.com/private/full</pre></div></div>

<p>.</p>
<p>Below is Google&#8217;s response. More importantly, see the resulting event <a href="href='http://www.google.com/calendar/event?eid=NXEzOHExOWgyczc1NnVtODkwMmI5ZjdtcnMgMnY3OGNyNTk3a2g0a2R1ZjNkYjl0NHAxZXNAZw'">here</a>. Enjoy.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">'utf-8'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">'http://www.w3.org/2005/Atom'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:batch</span>=<span style="color: #ff0000;">'http://schemas.google.com/gdata/batch'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:gCal</span>=<span style="color: #ff0000;">'http://schemas.google.com/gCal/2005'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:gd</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T11:32:34.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T11:32:35.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#kind'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">term</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>POSTed XML<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>I was POSTed using hand-crafted XML via the
  Protocol!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text/html'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/event?eid=NXEzOHExOWgyczc1NnVtODkwMmI5ZjdtcnMgMnY3OGNyNTk3a2g0a2R1ZjNkYjl0NHAxZXNAZw'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">title</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'edit'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs/63355951955'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Calendar Maven<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>calendar.maven@gmail.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:comments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:feedLink</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs/comments'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:comments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:eventStatus</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.confirmed'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:visibility</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.default'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:transparency</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.opaque'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:uid</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'5q38q19h2s756um8902b9f7mrs@google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:sequence</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:when</span> <span style="color: #000066;">startTime</span>=<span style="color: #ff0000;">'2008-09-01'</span> <span style="color: #000066;">endTime</span>=<span style="color: #ff0000;">'2008-09-02'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:who</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.organizer'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">valueString</span>=<span style="color: #ff0000;">'Secondary Calendar'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">email</span>=<span style="color: #ff0000;">'2v78cr597kh4kduf3db9t4p1es@group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:where</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
