Branch: master
Clone or download
Latest commit e8b0ec2 Oct 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
script Update nuget download script Dec 5, 2017
src
test/Cronofy.Test Split multi-recipient Smart Invites calls Oct 22, 2018
.editorconfig Initial spike of batch request support Nov 24, 2017
.gitignore
CHANGELOG.md Prepare 0.25.0 Oct 22, 2018
Cronofy.nuspec.template Add CHANGELOG.md to Nuget package Feb 9, 2017
Cronofy.sln Basic example console app Oct 20, 2015
LICENSE Renamed LICENCE to LICENSE Oct 23, 2015
Makefile Switch to msbuild and resolve compiler warnings Jan 10, 2018
README.md Add TimeZoneId to README example Mar 18, 2017
VERSION Prepare 0.25.0 Oct 22, 2018

README.md

Cronofy

Cronofy - one API for all the calendars (Google, iCloud, Exchange, Office 365, Outlook.com)

Installation

The Cronofy .NET SDK is available as a Nuget package, to install run the following command in the Package Manager Console

Install-Package Cronofy

More info is available on nuget

Usage

In order to use the Cronofy API you will need to create a developer account.

From there you can use your Calendar Sandbox to access your own calendars, or you can create an OAuth application to obtain an OAuth client_id and client_secret to be able to use the full API.

Authorization

API documentation

Generate a link for a user to grant access to their calendars:

const string CallbackUrl = "http://yoursite.dev/oauth2/callback";

var cronofy = new CronofyOAuthClient("clientId", "clientSecret");
var authorizationUrl = cronofy.GetAuthorizationUrlBuilder(CallbackUrl).Build();

The callback URL is a page on your website that will handle the OAuth 2.0 callback and receive a code parameter. You can then use that code to retrieve an OAuth token granting access to the user's Cronofy account:

var token = cronofy.GetTokenFromCode(code, CallbackUrl);

You should save the response's AccessToken and RefreshToken for later use.

Note that the exact same callback URL must be passed to both methods for access to be granted.

List calendars

API documentation

Get a list of all the user's calendars:

var cronofy = new CronofyAccountClient(accessToken);
var calendars = cronofy.GetCalendars();

Read events

API documentation

Get a list of events from the user's calendars:

var cronofy = new CronofyAccountClient(accessToken);
var events = cronofy.GetEvents();

Note that the SDK handles iterating through the pages on your behalf.

Create or update events

API documentation

To create/update an event in the user's calendar:

var cronofy = new CronofyAccountClient(accessToken);

var eventBuilder = new UpsertEventRequestBuilder()
    .EventId("uniq-id")
    .Summary("Event summary")
    .Description("Event description")
    .Start(2015, 10, 20, 17, 00)
    .End(2015, 10, 20, 17, 30)
    .TimeZoneId("Europe/London")
    .Location("Meeting room");

cronofy.UpsertEvent(calendarId, eventBuilder);

Delete events

API documentation

To delete an event from user's calendar:

var cronofy = new CronofyAccountClient(accessToken);
cronofy.DeleteEvent(calendarId, "uniq-id");

Links