posts - 598 , comments - 849 , trackbacks - 247

My Links

News

qrcode

Lance Robinson

Create Your Badge

Lance Robinson is a software engineer in Durham, Chapel Hill, Raleigh, and surrounding areas. More about Lance.

 Subscribe

Tag Cloud

Archives

Post Categories

Blogs

Miscellanous

Noteworthy Stuff

Popular Posts

10 DIY SharePoint Web Parts #10

This post is the tenth and last in a series of postings, containing examples of SharePoint WebParts that anybody can build all by themselves.  To read all posts in this series, or to get started with the RSSBus WebPart, go here.

#10 - Keep Your SharePoint Calendar Synced with Google

The following is one way you can use to keep your SharePoint Calendar(s) synced up with your Google Calendar.  This particular example only syncs in one direction:  from Google to SharePoint.  It could go the opposite direction, or both, but that's not what I need so that's not what I did.  :)  As usual, this solution requires that you have the RSSBus Web Part installed.  See here for instructions.  You'll also need the GoogleOps Connector, which is automatically included with the RSSBus Web Part.

google.GcalSharePointSync

Step one:  Logon to SharePoint and browse to your calendar.  Under Site Actions, click Edit Page.

Step two:  Now, click on "Add a Web Part", and add the RSSBus Web Part to the page.  I prefer to drag the Calendar up so that it is on top, and this RSSBus Web Part is just below it.  On its edit menu, click Modify Shared Web Part and open the Source Editor.

Step three:  Paste in the following RSSBus Web Part template, and click "Apply".

 
 
 
 
 
<rsb:info title="Google Calendar Sync" description="This template Syncs your SharePoint Calendar events with those in a Google Calendar account.">
  <input name="email" description="The email used to authenticate with Google." required="true"/>
  <input name="password" description="The password used to authenticate with Google." required="true" style="password"/>
  <input name="calendar" description="The SharePoint calendar to sync to." default="Calendar"/>
  <input name="days" description="The number of days to import events for." default="30"/>
</rsb:info>

<rsb:import lib="RSSBus.GoogleOps"/>

<!-- get all the events in the SharePoint calendar -->
<rsb:set attr="list" value="[[calendar]]"/>
<rsb:call op="spListItems" out="myitemout" save="myspitems" >
    <rsb:call op="spGetItem?itemid=[[sp:id]]" >
      <rsb:set attr="myitemout.title" value="[[sp:title]]"/>
      <rsb:set attr="myitemout.location" value="[[sp:location | def('')]]"/>
      <rsb:set attr="myitemout.start_time" value="[[sp:start_time]]"/>
      <rsb:set attr="myitemout.end_time" value="[[sp:end_time]]"/>
      <rsb:set attr="myitemout.description" value="[[sp:description | def('')]]" />
    </rsb:call>
</rsb:call>

<!--get all the events in the Google calendar in the specified range -->
<rsb:set attr="fromdate" value="[[null | date('d')]]"/>
<rsb:set attr="todate" value="[[fromdate | dateadd(day, [[days]]) | todate('d') ]]"/>
<rsb:call op="googleCalSearch" out="mygcalout" save="mygitems">
  <rsb:set attr="mygcalout.title" value="[[ggl:title]]"/>
  <rsb:set attr="mygcalout.location" value="[[ggl:where | def('')]]"/>
  <rsb:set attr="mygcalout.start_time" value="[[ggl:starttime | todate]]"/>
  <rsb:set attr="mygcalout.end_time" value="[[ggl:endtime | todate]]"/>
  <rsb:set attr="mygcalout.description" value="[[ggl:description | def('')]]"/>
</rsb:call>

<!-- now find out what is in google calendar that is not in the sharepoint list, using title and start time as the filter -->
<rsb:set attr="diff.base" value="[[_feeds.myspitems]]"/>
<rsb:set attr="diff.feed" value="[[_feeds.mygitems]]"/>
<rsb:set attr="diff.filter" value="title,start_time"/>
<rsb:set attr="diff.list" value="[[list]]"/>
<rsb:call op="feedDiff" in="diff">
  <!-- for everything not in the sp list, add it!  -->
  <rsb:set attr="name#" value="Title"/>
  <rsb:set attr="name#" value="Location"/>
  <rsb:set attr="name#" value="Start Time"/>
  <rsb:set attr="name#" value="End Time"/>
  <rsb:set attr="name#" value="Description"/>
  <rsb:set attr="value#" value="[[title]]"/>
  <rsb:set attr="value#" value="[[location | def('')]]"/>
  <rsb:set attr="value#" value="[[start_time]]"/>
  <rsb:set attr="value#" value="[[end_time]]"/>
  <rsb:set attr="value#" value="[[description | def('')]]"/>
  <rsb:call op="spAddItem"/>
  <b>[[title]]</b> Successfully imported from Google Calendar.<br>
</rsb:call>
 
 
 

Step four:  After you click Apply, you'll need to specify your Google Calendar email and password, the name of the calendar to sync with (ie, "Calendar"), and the number of days you want it to keep synced at a time.  Optionally, you can embed these inputs into the script if you want, instead of leaving them as web part properties.  To do that, change the rsb:info section of code to this:

<rsb:set attr="email" value="YOUREMAIL" />
<rsb:set attr="password" value="YOURPASSWORD" />
<rsb:set attr="calendar" value="YOURCALENDARNAME" />
<rsb:set attr="days" value="30" />

Now, everytime you view your Calendar page it will automatically be updated with the lastest items from Google Calendar.

See all posts in this series:  10 DIY SharePoint Web Parts.
Browse RSSBus Connectors.
Basic RSSBus Scripting Cheat Sheet.

Print | posted on Wednesday, January 13, 2010 1:19 PM |

Feedback

Gravatar

# re: 10 DIY SharePoint Web Parts #10

Could you please post how to make this sync both ways between the sharepoint and google calendar?
2/5/2010 4:30 PM | Marius
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Marius,

On my own SharePoint Calendar page, I actually have two web parts (1 for each direction of the sync). You could do it in one, but I have two just because. :)

I'll do another post soon about going the other direction. Until then I will email you a that template.

Also, a template for both directions will be published on the rssbus web part gallery soon.

If anybody else needs this, feel free to email me.
2/5/2010 4:41 PM | Lance Robinson
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Hi Lance,
I am having problem in displaying code in my blog. Can you tell me how to add the scroll area that you have added in this blog?
5/13/2010 1:20 PM | Dipesh
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Has the additional code on how to make this sync both ways between the sharepoint and google calendars been posted? If so, where, if not, or whatever, could you email it to me?
Thanks, JT
10/5/2010 11:53 AM | Doc
Gravatar

# re: 10 DIY SharePoint Web Parts #10

I've really enjoyed reading your top 10 webparts list. Have you visited the directory of webparts www.sharepointwebpart.co.uk I just came across it searching for a fileshare webpart.
10/14/2010 3:58 PM | Andrew
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Hi, I'm looking for the code to go the other way, sync from SharePoint to Google, did you ever get chance to post it? I couldn't find it. If you could share, that would be awesome!

Thanks,

Dan

12/8/2010 7:49 AM | Dan
Gravatar

# re: 10 DIY SharePoint Web Parts #10

I'd also love to see the code to go from SharePoint to Google.
9/22/2011 10:20 AM | Joseph Manzetti
Gravatar

# re: 10 DIY SharePoint Web Parts #10

If it is at all possible, I would also like to see the code to go from Sharepoint to Google.
10/4/2011 12:21 PM | Katie
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Hi,
I'm very new to all this, but would love a way to sync Google Calendar to my group's Sharepoint. However, I'm concerned with the password bit.... could other administrators potentially see the password once I've typed it in the script?
10/20/2011 4:34 AM | Emma
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Hi Lance Robinson
I would like to know how to sync from SharePoint calendar to Google calendar can you please help me to solve this. can you kindly email me at rithunithu0@gmail.com. Thanks




12/14/2012 1:43 AM | Rithu
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Hello,

I obtain an error message :
could not find the library 'RSSBus.GoogleOps'

CAn you help me?
10/3/2013 8:39 AM | Dominique Belge
Gravatar

# re: 10 DIY SharePoint Web Parts #10

Hi, I'm looking for the code from ShrePoint to Google. If you could share, that would be awesome.Plese share the code to : laxmi.pasupuleti@gmail.com

Please share as soon as possible, waiting for your reply.

Thanks
7/15/2014 4:16 AM | Laxmi
Gravatar

# re: 10 DIY SharePoint Web Parts #10

I would like the code for both directions if at all possible - cfontaine@palmerfoundry.com
12/5/2014 10:15 AM | cfontaine
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: