<?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>Thread.currentThread().join() &#187; Google Calendar</title>
	<atom:link href="http://www.ashishpaliwal.com/blog/tag/google-calendar/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ashishpaliwal.com/blog</link>
	<description>From Programmer, For Programmers</description>
	<lastBuildDate>Tue, 23 Aug 2011 03:53:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Updating Google Calendar with MS Project Tasks &#8211; 2 &#8211; Revisited</title>
		<link>http://www.ashishpaliwal.com/blog/2011/08/updating-google-calendar-with-ms-project-tasks-2-revisited/</link>
		<comments>http://www.ashishpaliwal.com/blog/2011/08/updating-google-calendar-with-ms-project-tasks-2-revisited/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 03:53:36 +0000</pubDate>
		<dc:creator>ashish</dc:creator>
				<category><![CDATA[Application Programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Google Calendar]]></category>
		<category><![CDATA[MS Project]]></category>

		<guid isPermaLink="false">http://www.ashishpaliwal.com/blog/?p=648</guid>
		<description><![CDATA[This is the 2nd part in the series. Please refer to Updating Google Calendar with MS Project Tasks - Revisited for Part 1, including how to build the code. In the previous post we saw, how to list all the Calendar's. In this post we shall build upon the code to list all the calendar's [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 2nd part in the series. Please refer to <a href="http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/">Updating Google Calendar with MS Project Tasks - Revisited</a> for Part 1, including how to build the code.</p>
<p>In the previous post we saw, how to list all the Calendar's. In this post we shall build upon the code to list all the calendar's for a given user account, and update the MS Project tasks to the selected calendar.</p>
<p>We shall need to following three steps:</p>
<ul>
<li>List Calendars and select one</li>
<li>Parse MS Project tasks and convert them to Calendar events</li>
<li>Update Google Calendar with Events</li>
</ul>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x60ImageOnly */
google_ad_slot = "0221726572";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<h3>Step 1: List All calendar's</h3>
<p>We have already seen the code for this in previous <a href="http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited">post</a></p>
<h3> Step 2: Parse MS Project task and convert to Calendar Event</h3>
<p>Lets look at the code for the conversion</p>
<pre class="brush: java">
protected CalendarEventEntry convertTaskToCalenderEntry(Task task) {
    System.out.println(&quot;Task &quot;+task);
    CalendarEventEntry eventEntry = new CalendarEventEntry();
    eventEntry.setTitle(new PlainTextConstruct(task.getName()));

    When date = new When();
    date.setStartTime(new DateTime(task.getStart()));
    eventEntry.addTime(date);
    return eventEntry;
}
</pre>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x15, created 8/2/10 */
google_ad_slot = "9956401459";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
The code takes Start and End date of task, as well as title, and creates an CalendarEventEntry for the same. There can be additional logic built into this, like filtering events based on some rules etc.</p>
<h3> Step 3: Updating entries into Google Calendar </h3>
<pre class="brush: java">
public void updateCalenderWithEntry(List&lt;Task&gt; tasks, CalendarService calendarService, URL url) {
    for (Task task : tasks) {
        CalendarEventEntry entry = convertTaskToCalenderEntry(task);
        try {
            calendarService.insert(url, entry);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ServiceException e) {
            e.printStackTrace();
        }
    }
}
</pre>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x15, created 8/2/10 */
google_ad_slot = "9956401459";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Here we just iterate through the tasks and update the events using CalendarService. The Calendar URL can be retrieved from the CalendarEntry class.</p>
<p>A complete working example is part of com.ashishpaliwal.mpputils.examples.MppToGoogleCalendar</p>
<h4>Using the sample program</h4>
<p>>com.ashishpaliwal.mpputils.examples.MppToGoogleCalendar [MPP File] [Google User Name] [password]</p>
<h3>What's Next?</h3>
<p>Eager to hear from user, what they would like to see. Adding a UI and out-of-box working package is something that would be good. However, please do try using this and I shall try my best to improve this.</p>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x60ImageOnly */
google_ad_slot = "0221726572";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ashishpaliwal.com/blog/2011/08/updating-google-calendar-with-ms-project-tasks-2-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Google Calendar with MS Project Tasks &#8211; Revisited</title>
		<link>http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/</link>
		<comments>http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 11:04:51 +0000</pubDate>
		<dc:creator>ashish</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Google Calendar]]></category>
		<category><![CDATA[MS Project]]></category>

		<guid isPermaLink="false">http://www.ashishpaliwal.com/blog/?p=619</guid>
		<description><![CDATA[Back in 2008, wrote the post on Updating Google Calendar with MS Project. Since then, lot many people had asked for the code, and myself felt that getting the code on github would be great. I shall keep complete the post in 2 parts, starting with setup, listing the calendars and then winding up with [...]]]></description>
			<content:encoded><![CDATA[<p>Back in 2008, wrote the post on <a href="http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/">Updating Google Calendar with MS Project</a>. Since then, lot many people had asked for the code, and myself felt that getting the code on github would be great. I shall keep complete the post in 2 parts, starting with setup, listing the calendars and then winding up with updating Google Calendar with MS Project entries.</p>
<p>To begin, you can get the code form github at following location</p>
<p><a href="https://github.com/paliwalashish/mpputils">https://github.com/paliwalashish/mpputils</a></p>
<h2>Building the code</h2>
<p>To build the code and download the dependencies, please refer to the wiki page <a href="https://github.com/paliwalashish/mpputils/wiki/Build">https://github.com/paliwalashish/mpputils/wiki/Build</a></p>
<h2> Retrieving Calendar's</h2>
<p>Now lets move to retrieving the list of all the Calendar's for a user<br />
The code is simple enough, here is the function which does the</p>
<pre class="brush: java">
public static List&lt;CalendarEntry&gt; getAllCalendars(String userName, String password) throws Exception {
        CalendarService myService = new CalendarService(&quot;CalendarService-&quot;+userName);
        myService.setUserCredentials(userName, password);

        // Send the request and print the response
        URL feedUrl = new URL(&quot;https://www.google.com/calendar/feeds/default/allcalendars/full&quot;);
        CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

        return resultFeed.getEntries();
    }
</pre>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x15LinkUnit */
google_ad_slot = "4400881690";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>This snippet shall return all the Calendar's for the specified user account.</p>
<p>The code has an example of using the same. Please refer to <em><strong>com.ashishpaliwal.mpputils.examples.ListAllCalendars</strong></em> class on the usage.</p>
<p>In the next part we shall see the code for updating of Google Calendar with MS Project task.</p>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x60TextOnly */
google_ad_slot = "8279148993";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Updating Google Calendar with MS Project Tasks</title>
		<link>http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/</link>
		<comments>http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 13:52:19 +0000</pubDate>
		<dc:creator>ashish</dc:creator>
				<category><![CDATA[Application Programming]]></category>
		<category><![CDATA[Apache POI]]></category>
		<category><![CDATA[GData API]]></category>
		<category><![CDATA[Google Calendar]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Microsoft Project]]></category>
		<category><![CDATA[MPXJ]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Task Tracking]]></category>

		<guid isPermaLink="false">http://www.ashishpaliwal.com/blog/?p=67</guid>
		<description><![CDATA[UPDATE Have an updated version of this writeup at http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/ I am back, as promised. Please read my earlier post Processing Microsoft Project File in Java using MPXJ. In this post we shall take an mpp and update the Google Calendar with the task details. The question is why would anyone do that?  Lets cook the [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE</p>
<p>Have an updated version of this writeup at <a href="http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/">http://www.ashishpaliwal.com/blog/2011/07/updating-google-calendar-with-ms-project-revisited/</a></p>
<hr>
<p>I am back, as promised. Please read my earlier post <a rel="bookmark" href="http://www.ashishpaliwal.com/blog/?p=58" target="_blank">Processing Microsoft Project File in Java using MPXJ</a>.</p>
<p>In this post we shall take an mpp and update the Google Calendar with the task details. The question is why would anyone do that? </p>
<p>Lets cook the story. A small team is working and the poor Project Manager share the Schedule with the team. The team is so busy coding that they forget to look at the dates, and the tasks they must be starting on. The poor Project Manager himself loose track unless he keeps MS Project Open on his desktop :-( A pretty common situation <img src='http://www.ashishpaliwal.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Have faced this situation and decided to organize myself and this post is outcome of that. The driving force was "Out of sight, is out of mind". So my assumption was if the team has a visual of the task dates, the chances of task slippage shall reduce a lot. </p>
<p>In this post, have built upon the my previous post to create an MPP parsing function. Have tried to keep the code in simplest form, so that it can customized later to specific needs. Have created a sample Schedule for this activity and used it for the implementation. Here is how it looks.</p>
<p> </p>
<div id="attachment_68" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/mpp.png"><img class="size-medium wp-image-68" title="mpp" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/mpp-300x39.png" alt="Google Calendar updater Project Schedule" width="300" height="39" /></a><p class="wp-caption-text">Google Calendar updater Project Schedule</p></div>
<p>The schdule is simple, some date, and tasks with dependencies. The concept shall work for any number of tasks.</p>
<p>Following are the steps that we need to perform:</p>
<ol>
<li>Parse the mpp file</li>
<li>Create a Calendar Service (Lets assume that the Calendar is already there, though it is possible to <span><span>programmatically</span></span> create the same)</li>
<li>Get All tasks from MPP, and create Calendar Entries in Google Calendar</li>
</ol>
<div><strong>The Code</strong></div>
<div>
<div id="attachment_69" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalupdatecode.png"><img class="size-full wp-image-69" title="Google Calendar Entry Creation Code" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalupdatecode.png" alt="Google Calendar Entry Creation Code" width="500" height="480" /></a><p class="wp-caption-text">Google Calendar Entry Creation Code</p></div>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x60ImageOnly */
google_ad_slot = "0221726572";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>The implementation is fairly simple. We have 3 functions:</p>
<ul>
<li>translateTaskToCalendarEventEntry() - Converts an Task into CalendarEventEntry, which can be added to Google Calendar</li>
<li>updateCalendar() - Takes input of all the Tasks from MPP, translates into CalendarEventEntry (using function translateTaskToCalendarEventEntry) and update the Calendar</li>
<li>updateGoogleCalendarWithMPP() - Parses the MPP using the util function from my previous post, and calls the API above to update the Calendar.</li>
</ul>
<p>Google Calendar API usage is described in details on Google's pages, hence won't discuss here.<br />
To use it for yourself, replace User Name and Password at line#70, with your User <span><span>Credentials</span></span>. Repace the URL at Line# 71 to point to your calendar.<br />
After running the program, this is how my Calendar looked like </p>
<dl id="attachment_72" class="wp-caption aligncenter" style="width: 510px;">
<dt class="wp-caption-dt"><a href="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalview.png"><img class="size-full wp-image-72" title="Google Calendar View" src="http://www.ashishpaliwal.com/blog/wp-content/uploads/2008/10/gcalview.png" alt="Google Calendar View" width="500" height="232" /></a></dt>
<dd class="wp-caption-dd">Google Calendar View</dd>
</dl>
<p>A simple way to keep track of Tasks.<br />
 </p></div>
<p><script type="text/javascript"><!--
google_ad_client = "ca-pub-6961884887741817";
/* 468x60ImageOnly */
google_ad_slot = "0221726572";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ashishpaliwal.com/blog/2008/10/updating-google-calendar-with-ms-project-tasks/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

