Blackbaud CRM™ Integration with Google Calendar™

Many nonprofit organizations use Google for Nonprofits including mail & calendar. In this post, we will show you how, step-by-step, to create Google Calendar Events from Blackbaud CRM™.

Before you get started, be sure you have the following prerequisites: Blackbaud CRM™ SDK, Visual Studio.

Part 1: Google Authentication

Your first step is to create an account through the Google Developer’s Console (https://console.developers.google.com/project). Creating a Google Developer's

account is straightforward as long as you have an existing Google account.

Next, you’ll need to create a new Project as shown below. The name can be anything you want, although it makes sense to be descriptive.

Under “APIs & auth/Credentials,” click “Create new Client ID” under “OAuth”

Select “Installed Application,” then proceed to the consent screen.

At minimum, you'll need to fill out the Product Name and Email Address

Next, you should be returned to the Create Client ID form. Under Installed Application Type, select “Other,” then click “Create Client ID.”

From here you should have a new Client ID. Click “Download JSON” and remember the location. We’ll need it as part of the Visual Studio project

The last step in the Developer’s Console is to allow a Google application to use authentication. Go to “APIs and auth/APIs,” then find “Calendar API” in the main list, and turn status to “ON”

Go to your Google Calendar and create an event.

Open Visual Studio. I am using 2013 in this example. Create a new Windows Forms Application in VB.NET

Next, you’ll need to import the appropriate Google APIs.

Tools>NuGet Package Manager>Manage NuGet Packages for Solution

Google APIs Auth Client Library

Then do the same thing, searching for “Google.Apis.Calendar.v3 Client Library”

Put the .json file you exported earlier in the bin/debug folder of the application.

On your form, place a button and a DataGridView Control, named btnGetEvents and grdEvents, respectively:

Add the following references to the form:

Imports System.IO

Imports System.Threading

Imports Google.Apis.Calendar.v3

Imports Google.Apis.Calendar.v3.Data

Imports Google.Apis.Calendar.v3.EventsResource

Imports Google.Apis.Services

Imports Google.Apis.Auth.OAuth2

Imports Google.Apis.Util.Store

Imports Google.Apis.Requests

Add the following class-level variables:

Dim _scopes As IList(Of String) = New List(Of String)()

Dim _service As CalendarService

Dim _AllEvents As New List(Of Data.Event)

Add the following Subroutines. Note that much of this was initially grabbed from here: https://code.google.com/p/google-api-dotnet-client/source/browse/Calendar.VB.ConsoleApp/Program.vb?repo=samples

In the line “Dim jsonFile…” make sure your file name matches the one you downloaded earlier.

Also be sure your googleAccount matches your own.

Private Sub btnGetEvents_Click(sender As Object, e As EventArgs) Handles btnGetEvents.Click

GetEvents()

End Sub

Private Sub GetEvents()

_scopes.Add(CalendarService.Scope.Calendar)

Dim jsonFile As String = "client_secret_791792756839-c1ev8q9gjgvep2qm1v2cl872joh2pd98.apps.googleusercontent.com.json"

Dim credential As UserCredential

Dim secrets As ClientSecrets

Dim fds As New FileDataStore("Calendar.VB.Sample")

Dim googleAccount As String = "brightvinesolutions@gmail.com"

Using stream As New FileStream(jsonFile, FileMode.Open, FileAccess.Read)

secrets = GoogleClientSecrets.Load(stream).Secrets

credential = GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, _scopes, googleAccount, CancellationToken.None, fds).Result

End Using

' Create the calendar service using an initializer instance

Dim initializer As New BaseClientService.Initializer()

initializer.HttpClientInitializer = credential

initializer.ApplicationName = "VB.NET Calendar Sample"

_service = New CalendarService(initializer)

' Fetch the list of calendar list

Try

Dim list As IList(Of CalendarListEntry) = _service.CalendarList.List().Execute().Items()

For Each calendar As Data.CalendarListEntry In list

' Display calendar's events

AddEventsToList(calendar)

Next

grdEvents.DataSource = _AllEvents

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

Private Sub AddEventsToList(list As CalendarListEntry)

Dim req As ListRequest = _service.Events.List(list.Id)

' Set MaxResults and TimeMin with sample values

req.MaxResults = 5

req.TimeMin = New DateTime(2013, 10, 1, 20, 0, 0)

' Fetch the list of events

_AllEvents.AddRange(req.Execute().Items)

End Sub

Now run the application and click the Get Calendar Events button. You may first see a screen like this, prompting you to allow the application to manage your calendars.

If everything is successful, you should see your data grid populated like this:

Now you've connected Blackbaud CRM TMwith Google Calendar, Step 1: authenticating and returning calendars in .NET.

Next up we'll review Step 2 , create a calendar event and add it as a CRM data form extension. If you'd like more info, please contact us today.

© 2017 BrightVine Solutions | All Rights Reserved

Offices:

Boston*

Charleston*

Charlotte

Nashville

Tallahassee 

Jacksonville/ Savannah

Atlanta 

843-900-4287

  • BrightVine on LinkedIn
  • BrightVine on Facebook
  • Twitter
Let's Connect

BrightVine Solutions, Inc. (BrightVine) is a member of the Blackbaud partner network. BLACKBAUD®, THE RAISER'S EDGE®, BLACKBAUDINTERNETSOLUTIONS®, BLACKBAUD CRM®, and RAISER'S EDGE® are registered trademarks of Blackbaud.  BRIGHTVINE, the BRIGHTVINE® LOGO, BRIGHTVINE DATALOADER® and DELIVERING EXCELLENCE FOR GOOD® are registered trademarks of BrightVine Solutions.

 

All other third-party trademarks mentioned on this website are the property of their respective owners.  Learn more about BrightVine on our blog